Class EventBus

  • All Implemented Interfaces:
    fish.payara.monitoring.collect.MonitoringDataSource, EventListener

    @Service(name="payara-event-bus")
    @RunLevel(10)
    public class EventBus
    extends Object
    implements EventListener, fish.payara.monitoring.collect.MonitoringDataSource
    A Hazelcast based Event Bus for Payara
    Since:
    4.1.153
    Author:
    steve
    • Constructor Detail

      • EventBus

        public EventBus()
    • Method Detail

      • postConstruct

        @PostConstruct
        public void postConstruct()
      • collect

        public void collect​(fish.payara.monitoring.collect.MonitoringDataCollector rootCollector)
        Specified by:
        collect in interface fish.payara.monitoring.collect.MonitoringDataSource
      • publish

        public boolean publish​(String topic,
                               ClusterMessage message)
        Sends out a message to all listeners in the Hazelcast sluster that are listening to the topic
        Parameters:
        topic -
        message -
        Returns:
      • addMessageReceiver

        public boolean addMessageReceiver​(String topic,
                                          MessageReceiver mr)
        Adds a message receiver to listen to message send on the Hazelcast EventBus
        Parameters:
        topic - The name of the topic to recive messages on
        mr - A MessageReciever to listen for messages
        Returns:
        true if successfully registered, false otherwise (i.e. if Hazelcast is not enabled)
      • removeMessageReceiver

        public void removeMessageReceiver​(String topic,
                                          MessageReceiver mr)
        Stops a message receiver from listening to messages on the specified topic
        Parameters:
        topic - The name of the topic that messages have been received on
        mr - The MessageReciever to stop listening for messages