Interface Bus


public interface Bus
Pub/Sub API.
Since:
1.6.0
See Also:
  • Method Details

    • publish

      <T> CompletionStage<Void> publish(String topic, T data, MessageOptions options)
      Publish data on specified topic.

      Targeting options may be provided in options argument.

      Type Parameters:
      T - the type of published data
      Parameters:
      topic - target topic, must not be null
      data - data to be published
      options - targeting options
      Returns:
      a stage that completes when data is sent, never null
      See Also:
    • publish

      default <T> CompletionStage<Void> publish(String topic, T data)
      Publish data on specified topic to all subscribers.
      Type Parameters:
      T - the type of published data
      Parameters:
      topic - message topic, must not be null
      data - data to be published
      Returns:
      a stage that completes when data is sent, never null
    • subscribe

      <T> CompletionStage<Subscription> subscribe(String topic, BusMessageHandler<T> handler, MessageOptions options)
      Subscribes for messages on specified topic and optionally routing key and/or target.

      Interest for specific routing key and/or target may be provided in options argument.

      To unsubscribe close the Subscription in the result feature.

      Parameters:
      topic - interest topic, must not be null
      handler - message handler, must not be null
      options - interest options like routing
      Returns:
      a stage that completes when subscribed, never null
      See Also:
    • subscribe

      default <T> CompletionStage<Subscription> subscribe(String topic, BusMessageHandler<T> handler)
      Subscribes for all messages on specified topic.
      Type Parameters:
      T - the type of the received data
      Parameters:
      topic - topic, must not be null
      handler - handler, must not be null
      Returns:
      a stage that completes when subscribed
      See Also: