Package org.nuxeo.runtime.pubsub
Interface PubSubService
-
- All Known Implementing Classes:
PubSubServiceImpl
public interface PubSubService
Publish/Subscribe Service.This service allows cross-instance notifications through simple messages sent to topics.
- Since:
- 9.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
publish(String topic, byte[] message)
Publishes a message to the given topic.void
registerSubscriber(String topic, BiConsumer<String,byte[]> subscriber)
Registers a subscriber for the given topic.void
unregisterSubscriber(String topic, BiConsumer<String,byte[]> subscriber)
Unregisters a subscriber for the given topic.
-
-
-
Method Detail
-
publish
void publish(String topic, byte[] message)
Publishes a message to the given topic.- Parameters:
topic
- the topicmessage
- the message
-
registerSubscriber
void registerSubscriber(String topic, BiConsumer<String,byte[]> subscriber)
Registers a subscriber for the given topic.The subscriber must deal with the message without delay and return immediately, usually by storing it in a thread-safe datastructure.
- Parameters:
topic
- the topicsubscriber
- the subscriber, who will receive the topic and abyte[]
message
-
unregisterSubscriber
void unregisterSubscriber(String topic, BiConsumer<String,byte[]> subscriber)
Unregisters a subscriber for the given topic.- Parameters:
topic
- the topicsubscriber
- the subscriber
-
-