Class AbstractPubSubBroker<T extends SerializableMessage>

    • Method Detail

      • initialize

        public void initialize​(String topic,
                               String discriminator)
        Initializes the broker.
        Parameters:
        topic - the topic
        discriminator - the discriminator
      • close

        public void close()
        Closes this broker and releases resources.
      • sendMessage

        public void sendMessage​(T message)
        Sends a message to other nodes.
      • subscriber

        protected void subscriber​(String topic,
                                  byte[] bytes)
        PubSubService subscriber, called from a separate thread.
      • receivedMessage

        public abstract void receivedMessage​(T message)
        Callback implementing the delivery of a message from another node.
        Parameters:
        message - the received message
      • scanDiscriminator

        protected int scanDiscriminator​(byte[] message)
        Scans for the discriminator and returns the payload start offset.
        Returns:
        payload start offset, or -1 if the discriminator is local or if the message is invalid