Interface IEventBroker
-
public interface IEventBrokerTo obtain an instance of the event broker service from theIEclipseContextcontext, usecontext.get(IEventBroker.class)
- Since:
- 1.1
- Restriction:
- This interface is not intended to be implemented by clients.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanpost(String topic, Object data)Publish event asynchronously (this method returns immediately).booleansend(String topic, Object data)Publish event synchronously (the method does not return until the event is processed).booleansubscribe(String topic, String filter, EventHandler eventHandler, boolean headless)Subscribe for events on the given topic.booleansubscribe(String topic, EventHandler eventHandler)Subscribe for events on the given topic.booleanunsubscribe(EventHandler eventHandler)Unsubscribe handler previously registered usingsubscribe(String, EventHandler).
-
-
-
Field Detail
-
DATA
static final String DATA
The name of the default event attribute used to pass data.- See Also:
- Constant Field Values
-
-
Method Detail
-
send
boolean send(String topic, Object data)
Publish event synchronously (the method does not return until the event is processed).If data is a
Mapor aDictionary, it is passed as is. Otherwise, a new Map is constructed and itsDATAattribute is populated with this value.- Parameters:
topic- topic of the event to be publisheddata- data to be published with the event- Returns:
trueif this operation was performed successfully;falseotherwise
-
post
boolean post(String topic, Object data)
Publish event asynchronously (this method returns immediately).If data is a
Mapor aDictionary, it is passed as is. Otherwise, a new Map is constructed and itsDATAattribute is populated with this value.- Parameters:
topic- topic of the event to be publisheddata- data to be published with the event- Returns:
trueif this operation was performed successfully;falseotherwise
-
subscribe
boolean subscribe(String topic, EventHandler eventHandler)
Subscribe for events on the given topic.The handler will be called on the UI thread.
- Parameters:
topic- topic of interesteventHandler- object to call when an event of interest arrives- Returns:
trueif this operation was performed successfully;falseotherwise
-
subscribe
boolean subscribe(String topic, String filter, EventHandler eventHandler, boolean headless)
Subscribe for events on the given topic.The handler will be called on the UI thread if "headless" is set to
false.- Parameters:
topic- topic of interestfilter- the LDAP event filtereventHandler- object to call when an event of interest arrivesheadless-trueif handing of the events does not require UI;falseotherwise- Returns:
trueif this operation was performed successfully;falseotherwise
-
unsubscribe
boolean unsubscribe(EventHandler eventHandler)
Unsubscribe handler previously registered usingsubscribe(String, EventHandler).- Parameters:
eventHandler- previously registered event handler- Returns:
trueif this operation was performed successfully;falseotherwise
-
-