Class NatsProducer

All Implemented Interfaces:
AdaptrisComponent, AdaptrisMessageProducer, AdaptrisMessageSender, AdaptrisMessageWorker, ComponentLifecycle, ComponentLifecycleExtension, MessageEventGenerator

@ComponentProfile(summary="Send a message to a NATS server", tag="nats.io, nats", recommended=NatsConnection.class, since="3.9.3") public class NatsProducer extends RequestReplyProducerImp
Produce the current message to a NATS server with the configured subject.

This effectively uses the Connection#publish(String, byte[]) or Connection#request(String, byte[], java.time.Duration) to send the message to NATS. The subject will be derived form the configured destination.

Since the payload for NATS.io is always an opaque set of bytes; if you wish to include AdaptrisMessage.getMetadata() in the message, then you will have to configure a AdaptrisMessageEncoder instance; otherwise all metadata is lost.

In the adapter configuration file this class is aliased as nats-standard-producer which is the preferred alternative to the fully qualified classname when building your configuration.