Package fish.payara.nucleus.eventbus
Class EventBus
- java.lang.Object
-
- fish.payara.nucleus.eventbus.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.glassfish.api.event.EventListener
EventListener.Event<T>
-
-
Constructor Summary
Constructors Constructor Description EventBus()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addMessageReceiver(String topic, MessageReceiver mr)
Adds a message receiver to listen to message send on the Hazelcast EventBusvoid
collect(fish.payara.monitoring.collect.MonitoringDataCollector rootCollector)
void
event(EventListener.Event event)
Process a Glassfish/Payara eventvoid
postConstruct()
boolean
publish(String topic, ClusterMessage message)
Sends out a message to all listeners in the Hazelcast sluster that are listening to the topicvoid
removeMessageReceiver(String topic, MessageReceiver mr)
Stops a message receiver from listening to messages on the specified topic
-
-
-
Method Detail
-
postConstruct
@PostConstruct public void postConstruct()
-
collect
public void collect(fish.payara.monitoring.collect.MonitoringDataCollector rootCollector)
- Specified by:
collect
in interfacefish.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 onmr
- AMessageReciever
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 onmr
- TheMessageReciever
to stop listening for messages
-
event
public void event(EventListener.Event event)
Description copied from interface:EventListener
Process a Glassfish/Payara event- Specified by:
event
in interfaceEventListener
-
-