Remote CDI Events in Payara Micro

Payara Micro can listen to and fire CDI events across the cluster of Payara Micro instances, and also across Payara Server instances within the same cluster. Payara Micro supports the same functionality for remote CDI events as provided by Payara Server.

Payara Micro also provides additional methods to fire events and register listeners programmatically.

These methods are used for firing CDI Events across running instances.

Method Description

void addCDIEventListener(CDIEventListener listener)

Adds a CDI Event Listener.

void removeCDIEventListener(CDIEventListener listener)

Removes a CDI Event Listener.

void addClusterListener(PayaraClusterListener listener)

Adds a Cluster Listener.

void removeClusterListener(PayaraClusterListener listener)

Removes a Cluster Listener.

void publishCDIEvent(PayaraClusteredCDIEvent event)

Publishes a CDI Event.

This feature has been available in Payara Micro long before it was available in Payara Server.

Manual initialization of the Event Bus

On prior releases, it was necessary to initialize the event bus using ClusteredCDIEventBus.initialize() manually upon startup. Although this method is still available in the API, it is not necessary anymore, since the event bus is automatically initialized after an application is started.