The publish Task
publish publishes data to the message queue.
Configuration options
topic-
topicis the name of the message queue topic where the message should be published. Alias:subject.Required for publish with type
natsandstan. Ignored with other types. (seetypeoption below).For example, publish to
myqueue:topic:myqueue type-
typedetermines what downstream message queue to use. If unspecified, it will use the same queue the agent is configured to use (by default NATS). Supported values arenats,stan,tcpandhttp.-
nats: will publish to a NATS queue. -
stan: will publish to a NATS Streaming queue.For example, to publish to
Nats Streamingon topic ofmytopic:type:stan;topic:mytopic -
http: will publish to an HTTP Server. The message will be sent as the body of an HTTP POST request to a server at the address defined inaddr(seeaddroption below).For example, to send an HTTP POST request for each message to
http://example.com:type:http;addr:http://example.com -
tcp: will publish to a TCP connection. It will publish each message with a new line seperator (\n).For example, to send messages to a TCP connection at
localhost:57412:type:tcp;addr:localhost:57412
-
addr-
addris the endpoint for the messages publication. The format of this field depends on thetype:-
http: this is the fully qualified HTTP address.
E.g.https://example.com
By default,addrishttp://localhost:8888fortype: http.type:http;addr:http://example.com/myendpoint -
tcp: this is the full TCP address with domain/IP and port.
E.g.example.com:1234or127.0.0.1:8745.
By default,addrislocalhost:9090fortype: tcp.type:tcp;addr:localhost:5174
-
labels-
labelsis a list of labels to be attached to the published message. Use the symbol+to separate the labels.For example:
labels:a=b+c=d