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 Detail

      • publish

        void publish​(String topic,
                     byte[] message)
        Publishes a message to the given topic.
        Parameters:
        topic - the topic
        message - 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 topic
        subscriber - the subscriber, who will receive the topic and a byte[] message
      • unregisterSubscriber

        void unregisterSubscriber​(String topic,
                                  BiConsumer<String,​byte[]> subscriber)
        Unregisters a subscriber for the given topic.
        Parameters:
        topic - the topic
        subscriber - the subscriber