Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

NATS Component

Tip
titleAvailable since Camel 2.17.0
 

NatsNATS is a fast and reliable messaging platform.

...

Code Block
xml
xml
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-nats</artifactId>
    <!-- use the same version as your Camel core version -->
    <version>x.y.z</version>
</dependency>

URI format

Code Block
nats:servers[?options]

Where servers represents the list of nats NATS servers.

Options

Name

Default Value

Description

servers

null

Defines the servers the component should connect to.

topicnullThe topic to connect subscribe/publish to.
reconnecttrueWhether or not using to use the reconnection feature.
pedanticfalseWhether or not running in pedantic mode (this affects performance).
verbosefalseWhether or not running in verbose mode
sslfalseWherer Whether or not using sslto use SSL
reconnectTimeWait2000 Waiting Waiting time before attempts reconnection (in milliseconds)
maxReconnectAttempts3To set the maximum time an action could take to completeSet the maximum number of reconnection attempts in case the connection is lost.
pingInterval4000Ping interval to be aware if connection is still alive (in milliseconds)
noRandomizeServersfalseWhether or not randomizing to randomize the order of servers for the connection attempts
queueNamenullThe Queue name if we are using nats NATS for a queue configuration (consumer).
maxMessagesnullStop receiving messages from a topic we are subscribing to after maxMessages (consumer).
poolSize10The Queue name if we are using nats for a queue configuration Pool size for consumer workers (consumer).

Headers

NameTypeDescription
natsMessageTimestamp

CamelNatsMessageTimestamp

longThe timestamp of a consumed message.
natsSubscribeSid

CamelNatsSubscriptionId

Integer

The subscription Id ID of a consumer.

 

Producer example:

Code Block
languagejava
from("direct:send").to("nats://localhost:4222?topic=test");

...