You can use the e4 Event Broker to do this.
In the part that wants to send events inject the event broker:
@Inject
private IEventBroker eventBroker;
To send data asynchronously use:
eventBroker.post("base_topic/data_event", data);
to send synchronously use:
eventBroker.send("base_topic/data_event", data);
In your part that wants to receive the data use:
@Inject
@Optional
void dataEvent(@EventTopic("base_topic/data_event") DataType data)
if you want the data to be received on the UI thread use @UIEventTopic
instead of @EventTopic
.
The event topic names are something you decide on, I have just used an example here.
Note: Since this uses injection the code must be in something like an MPart
class (or you must do the injection yourself).
More details here