# NATS C Client with JetStream and Streaming support: microClient

Loading...
Searching...
No Matches
microClient
EXPERIMENTAL - Microservices » Functions

## Functions

NATS_EXTERN microError * | micro_NewClient (microClient **new_client, natsConnection *nc, microClientConfig *cfg)
| Creates a new microservice client.
NATS_EXTERN void | microClient_Destroy (microClient *client)
| Destroys a microservice client.
NATS_EXTERN microError * | microClient_DoRequest (natsMsg **reply, microClient *client, const char *subject, const char *data, int data_len)
| Sends a request to a microservice and receives the response.

## Detailed Description

## Function Documentation

## micro_NewClient()

NATS_EXTERN microError * micro_NewClient | ( | microClient ** | new_client,
|  | natsConnection * | nc,
|  | microClientConfig * | cfg
| ) |  |

Parameters

  new_client | received the pointer to the new client.
  nc | a NATS connection.
  cfg | for future use, use NULL for now.

Returns
  a microError if an error occurred.

## microClient_Destroy()

NATS_EXTERN void microClient_Destroy | ( | microClient * | client | ) |

Parameters

  client | the client to destroy.

## microClient_DoRequest()

NATS_EXTERN microError * microClient_DoRequest | ( | natsMsg ** | reply,
|  | microClient * | client,
|  | const char * | subject,
|  | const char * | data,
|  | int | data_len
| ) |  |

Parameters

  reply | receives the pointer to the response NATS message. `reply` must be freed with natsMsg_Destroy.
  client | the client to use.
  subject | the subject to send the request on.
  data | the request data.
  data_len | the request data length.

Returns
  a microError if an error occurred.