org.eclipse.e4.core.services.events

## Interface IEventBroker

    public interface IEventBroker

To obtain an instance of the event broker service from the `IEclipseContext` context, use

     (IEventBroker) context.get(IEventBroker.class.getName())

Since:
  1.1
Restriction:
  This interface is not intended to be implemented by clients.

### Field Summary

Fields
`static String` `DATA` The name of the default event attribute used to pass data.

### Method Summary

All Methods Instance Methods Abstract Methods
`boolean` `post(String topic, Object data)` Publish event asynchronously (this method returns immediately).
`boolean` `send(String topic, Object data)` Publish event synchronously (the method does not return until the event is processed).
`boolean` `subscribe(String topic, EventHandler eventHandler)` Subscribe for events on the given topic.
`boolean` `subscribe(String topic, String filter, EventHandler eventHandler, boolean headless)` Subscribe for events on the given topic.
`boolean` `unsubscribe(EventHandler eventHandler)` Unsubscribe handler previously registered using `subscribe(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 `Map` or a `Dictionary`, it is passed as is. Otherwise, a new Map is constructed and its `DATA` attribute is populated with this value.

Parameters:
  `topic` - topic of the event to be published
  `data` - data to be published with the event
Returns:
  `true` if this operation was performed successfully; `false` otherwise

#### post

    boolean post(String topic,
                 Object data)

Publish event asynchronously (this method returns immediately).

If data is a `Map` or a `Dictionary`, it is passed as is. Otherwise, a new Map is constructed and its `DATA` attribute is populated with this value.

Parameters:
  `topic` - topic of the event to be published
  `data` - data to be published with the event
Returns:
  `true` if this operation was performed successfully; `false` otherwise

#### 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 interest
  `eventHandler` - object to call when an event of interest arrives
Returns:
  `true` if this operation was performed successfully; `false` otherwise

#### 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 interest
  `filter` - the LDAP event filter
  `eventHandler` - object to call when an event of interest arrives
  `headless` - `true` if handing of the events does not require UI; `false` otherwise
Returns:
  `true` if this operation was performed successfully; `false` otherwise

#### unsubscribe

    boolean unsubscribe(EventHandler eventHandler)

Unsubscribe handler previously registered using `subscribe(String, EventHandler)`.

Parameters:
  `eventHandler` - previously registered event handler
Returns:
  `true` if this operation was performed successfully; `false` otherwise