NATS icon

NATS

NATS

Request

AI-generated

Overview

This node sends requests to a NATS messaging service. It allows users to specify the subject of the message, the payload content type (string or binary), and the payload itself. Users can also add custom headers and configure options such as saving content as binary, parsing JSON responses, limiting the number of replies, and setting timeouts. This node is useful for integrating with systems that communicate via NATS, enabling message-based interactions such as sending commands or queries and receiving responses.

Use Case Examples

  1. Sending a command message to a microservice via NATS with a JSON payload.
  2. Requesting data from a NATS service and parsing the JSON response automatically.
  3. Sending binary data as a payload to a NATS subject and saving the response as binary.

Properties

Name Meaning
Subject The subject or topic to which the request message is sent.
Payload Content Type The type of content in the payload, either a string or binary data.
Payload The actual message content to send when the payload content type is string.
Payload Binary Property Name The property name in the binary data to use as the payload when the content type is binary.
Headers Custom headers to include in the request message.
Options Additional options to control request behavior, such as saving content as binary, parsing JSON body, max replies, returning only content, requesting multiple replies, and timeout.

Output

JSON

  • json - The JSON response from the NATS service, which may include the content or full response object depending on options.

Dependencies

  • NATS service connection
  • An API key credential for NATS authentication

Troubleshooting

  • If the node fails to connect, verify the NATS service credentials and network connectivity.
  • Errors during request execution may include context with item index for easier debugging.
  • If JSON parsing fails, ensure the response body is valid JSON when the JSON Parse Body option is enabled.
  • Timeout errors may occur if the service does not respond within the specified timeout period.

Discussion