NATS C Client with JetStream and Streaming support: Callbacks

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

Loading...
Searching...
No Matches
Typedefs
Callbacks
- Microservices

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

## 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

  req | The 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

  m | The microservice object.
  ep | The endpoint object, or NULL if the error is not associated with an endpoint.
  s | The 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

  m | The microservice object.

See also
  microServiceConfig, micro_service_config_s.