Package com.tick42.glue.core.bus
Interface Bus
public interface Bus
Pub/Sub API.
- Since:
- 1.6.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> CompletionStage<Void> Publish data on specified topic to all subscribers.<T> CompletionStage<Void> publish(String topic, T data, MessageOptions options) Publish data on specified topic.default <T> CompletionStage<Subscription> subscribe(String topic, BusMessageHandler<T> handler) Subscribes for all messages on specified topic.subscribe(String topic, BusMessageHandler<T> handler, MessageOptions options) Subscribes for messages on specified topic and optionally routing key and/or target.
-
Method Details
-
publish
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 benulldata- data to be publishedoptions- targeting options- Returns:
- a stage that completes when data is sent, never
null - See Also:
-
publish
Publish data on specified topic to all subscribers.- Type Parameters:
T- the type of published data- Parameters:
topic- message topic, must not benulldata- 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
Subscriptionin the result feature.- Parameters:
topic- interest topic, must not benullhandler- message handler, must not benulloptions- interest options like routing- Returns:
- a stage that completes when subscribed, never
null - See Also:
-
subscribe
Subscribes for all messages on specified topic.- Type Parameters:
T- the type of the received data- Parameters:
topic- topic, must not benullhandler- handler, must not benull- Returns:
- a stage that completes when subscribed
- See Also:
-