Clients -
nats :
Producer
NATS Producer
would act as a basic client allowing to publish messages to the NATS server.
Producer needs the NATS Connection
to be initialized.
Constructor
__init
(Connection connection)
- connection Connection
-
An already-established connection.
Remote Methods
publish | Produces a message to a NATS basic server for the given subject. |
request | Produces a message and would wait for a response. |
Methods
Produces a message to a NATS basic server for the given subject.
Parameters
- subject string
-
The subject to send the message to.
- data Content
-
Data to publish.
- replyTo string | service | () (default ())
-
The subject or the callback service the receiver should send the response to.
-
Return Type
(Error?) A specific error if there is a problem when publishing the message. Returns () otherwise.
Produces a message and would wait for a response.
Parameters
- subject string
-
Would represent the topic/queue name.
- data Content
-
The message body to publish.
- duration int? (default ())
-
The time to wait for a response measured in milliseconds.