The subscribe Task

Type

Source

Output

Message

subscribe is a queue subscription task.

Configuration options

topic

topic is the name of the message queue topic to subscribe to. Alias: subject.

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

+ For example, subscribe to myqueue:

topic:myqueue
type

type determines what updstream 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 subscribe to a NATS queue.

  • stan: will subscribe to a NATS Streaming queue.

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

    type:stan;topic:mytopic
  • http: will listen start an HTTP Server at addr (see addr option below). The message will be receive as the body of an HTTP POST from a client. Headers are ignored. https is not supported.

    For example, to receive a HTTP POST requests for each message on http://localhost:78945:

    type:http;addr:http://localhost:78945
  • tcp: will listen on a TCP connection. It will receive each message separated by a new line seperator (\n).

    For example, to receive messages on a TCP connection at localhost:57412:

    type:tcp;addr:localhost:57412
addr

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

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

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

    type:tcp;addr:localhost:5174

Conditions

subscribe is not directly affected by conditions.

Output

The output of subscribe depends on the data received.