NATS C Client with JetStream and Streaming support  3.9.1
The nats.io C Client, Supported by Synadia Communications Inc.

Typedefs

typedef microError *(* microRequestHandler) (microRequest *req)
 Callback type for request processing. More...
 
typedef void(* microErrorHandler) (microService *m, microEndpoint *ep, natsStatus s)
 Callback type for async error notifications. More...
 
typedef void(* microDoneHandler) (microService *m)
 Callback type for Done (service stopped) notifications. More...
 

Detailed Description

Microservice callbacks.

Typedef Documentation

◆ microRequestHandler

typedef microError*(* microRequestHandler) (microRequest *req)

This is the callback that one provides when creating a microservice endpoint. The library will invoke this callback for each message arriving to the specified subject.

Parameters
reqThe request object, containing the message and other relevant references.
See also
microEndpointConfig, micro_endpoint_config_s.

◆ microErrorHandler

typedef void(* microErrorHandler) (microService *m, microEndpoint *ep, natsStatus s)

If specified in microServiceConfig, this callback is invoked for internal errors (e.g. message delivery failures) related to a microservice. If the error is associated with an endpoint, the ep parameter points at the endpoint. However, this handler may be invoked for errors happening in monitoring subjects, in which case ep is NULL.

The error handler is invoked asynchronously, in a separate theread.

The error handler is not invoked for microservice-level errors that are sent back to the client as responses. Note that the error counts in microEndpointStats include both internal and service-level errors.

Parameters
mThe microservice object.
epThe endpoint object, or NULL if the error is not associated with an endpoint.
sThe NATS status for the error.
See also
microServiceConfig, micro_service_config_s.

◆ microDoneHandler

typedef void(* microDoneHandler) (microService *m)

If specified in microServiceConfig, this callback is invoked right after the service stops. In the C client, this callback is invoked directly from the microService_Stop function, in whatever thread is executing it.

Parameters
mThe microservice object.
See also
microServiceConfig, micro_service_config_s.