The publish Task

Type

Destination

Output

NONE

publish publishes data to the message queue.

Configuration options

topic

topic is the name of the message queue topic where the message should be published. Alias: subject.

Required for publish with type nats and stan. Ignored with other types. (see type option below).

For example, publish to myqueue:

topic:myqueue
type

type determines 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 are nats, stan, tcp and http.

  • nats: will publish to a NATS queue.

  • stan: will publish to a NATS Streaming queue.

    For example, to publish to Nats Streaming on topic of mytopic:

    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 in addr (see addr option 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

addr is the endpoint for the messages publication. The format of this field depends on the type:

  • http: this is the fully qualified HTTP address.
    E.g. https://example.com
    By default, addr is http://localhost:8888 for type: http.

    type:http;addr:http://example.com/myendpoint
  • tcp: this is the full TCP address with domain/IP and port.
    E.g. example.com:1234 or 127.0.0.1:8745.
    By default, addr is localhost:9090 for type: tcp.

    type:tcp;addr:localhost:5174
labels

labels is 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

Conditions

publish is not directly affected by conditions.

Output

publish.meta.labels

map-optional Holds the labels attached to the published message, if the labels option is set.