Accessor: net/VertxSubscribe

net/VertxSubscribe

This accessor subscribes to a Vert.x event bus, which is a peer-to-peer publish-and-subscribe system. This accessor will receive data that is sent by any subscriber that publishes to the same address and runs in the same Vertx cluster (see the VertxPublish accessor). The Vertx cluster normally includes all machines that hear multicast packets sent by the machine hosting this accessor.

The output produced by this accessor may be any data type supported by accessors that has a string representation in JSON syntax. The data sent by a VertxPublish accessor is first converted to a string in JSON format and sent to the event bus. This VertxSubscribe accessor will parse that string and output the data in the native format of its host.

If the reply input is set to a non-empty value, then whenever this accessor receives a point-to-point message from the event bus (see VertxPublish), then it will reply with the specified message, acknowledging receipt. The reply can also be any data type that has a JSON string representation.

The busHost input specifies the name of the network interface through which to connect to the Vert.x event bus cluster, and busHostPort specifies the port to use for this. Normally, you can leave these at their default values unless you need to need to use a network interface that is not 'localhost' or you need to use a particular port. These two inputs are examined only at initialization time, so changing them during execution of a swarmlet will have no effect.

Version:
  • $$Id$$
Author:
  • Patricia Derler, Edward A. Lee, Ben Zhang
Source:
Inputs:
Name Type Description
address string The event bus address, which is the name of the event stream to which to subscribe. This defaults to 'topic'.
reply The reply to send back to the sender for point-to-point messages, or empty to send no reply (the default).
Outputs:
Name Type Description
message The message received.
Parameters:
Name Type Description
busHost string The name of the network interface to use for the Vert.x event bus. A blank string is interpreted as 'localhost' (the default).
busHostPort int The port for the Vert.x event bus. A value of 0 indicates to just find an available port (the default).

Methods

(static) setup()

Set up the accessor by defining the inputs, outputs, and parameters.

Source: