# NATS C Client with JetStream and Streaming support: micro_service_config_s Struct Reference

Loading...
Searching...
No Matches
micro_service_config_s Struct Reference
EXPERIMENTAL - Microservices » Public structs

The Microservice top-level configuration object. More...

`#include <nats.h>`

## Public Attributes

const char * | Name
| The name of the service.
const char * | Version
| The (semantic) version of the service.
const char * | Description
| The description of the service.
natsMetadata | Metadata
| Metadata for the service, a JSON-encoded user-provided object, e.g. `{"key":"value"}`
microEndpointConfig * | Endpoint
| The "main" (aka default) endpoint configuration.
microRequestHandler | StatsHandler
| A custom stats handler.
microErrorHandler | ErrHandler
| An error notification handler.
microDoneHandler | DoneHandler
| A callback handler for handling the final cleanup `Done` event, right before the service is destroyed.
void * | State
| A user-provided pointer to state data.

## Detailed Description

The service is created with a clone of the config and all of its values, so the original can be freed or modified after calling micro_AddService.

## Member Data Documentation

## Name

const char* micro_service_config_s::Name

It can be used to compose monitoring messages specific to this service.

## Version

const char* micro_service_config_s::Version

## Description

const char* micro_service_config_s::Description

## Metadata

natsMetadata micro_service_config_s::Metadata

## Endpoint

microEndpointConfig* micro_service_config_s::Endpoint

It is the default in that it does not require calling microService_AddEndpoint, it is added automatically when creating the service.

## StatsHandler

microRequestHandler micro_service_config_s::StatsHandler

It will be called to output the service's stats. It replaces the default stats handler but can pull the service stats using microService_GetStats function, then marshal them itself, as appropriate.

## ErrHandler

microErrorHandler micro_service_config_s::ErrHandler

It will be called asynchonously upon internal errors. It does not get called for application-level errors, successfully sent out by the microservice.

## DoneHandler

microDoneHandler micro_service_config_s::DoneHandler

It will be called directly from microService_Stop method, so it may be executed in any of the user threads or in the async callback thread if the service stops itself on connection closed or an error event.

## State

void* micro_service_config_s::State

A closure that is accessible from the request, stats, and internal event handlers. Please note that handlers are invoked on separate threads, consider thread-safe mechanisms of accessing the data.

The documentation for this struct was generated from the following file:

- nats.h