Skip Navigation

Addressed Events

Since SDK version 2.11 a new feature, addressed events, is available . It allows sending an event to the specified Red App or Red Apps. Based on this mechanism you can build asynchronous (all events are asynchronous) mechanism for particular Red Apps notification.

The event producer makes a decision on who will receive an event. For example, if Red App A, B, and C are listening on some EVENT_ID but producer is specifying that it should be supplied only to A and B then C will be omitted in broadcasting process.

Sending addressed events:

  • Prerequisite: <br> Add dependency on bundle to MANIFEST.MF<br>

  • Coding steps <br>

Get a reference to ISRWCommunication service via activator and instantiate event client.

ISRWCommunication com = Activator.getDefault().getServiceReference(ISRWCommunication.class); EventClient eClient = new EventClient(com);

Prepare event builder and specify exclusively which Red App IDs event should be supplied to.

EventBuilder eBuilder = EventBuilder.create("event_id").withTarget("","");

Send event via EventClient using processPost() method to send POST event or processPre() to send PRE event.



Listening to addressed events

There is no difference in listening to either basic or addressed event. Red App should register implementation of IEventListener as described in About Event Listeners and Event Listening in Red Apps.