public class EventBusHook extends Object implements ComponentHook
This hook publishes events to the event bus. Messages are published to the given address. If no address is provided then messages will be published to the internal address of the component to which the hook is attached.
Messages are formatted as JsonObject instances. Each message will have
an event key which indicates the event that occurred. Additional
keys depend on the event.
You can use an EventBusHookListener to listen for messages from an
EventBusHook. This listener will handle parsing messages and
calling event handlers.
| Constructor and Description |
|---|
EventBusHook() |
EventBusHook(String address) |
| Modifier and Type | Method and Description |
|---|---|
void |
handleReceive(Object message)
Called when a message has been received on the input.
|
void |
handleSend(Object message)
Called when a message has been sent on the output.
|
void |
handleStart(Component component)
Called when the component has started.
|
void |
handleStop(Component subject)
Called when the component has stopped.
|
public EventBusHook()
public EventBusHook(String address)
public void handleStart(Component component)
ComponentHookhandleStart in interface ComponentHookcomponent - The component that was started.public void handleSend(Object message)
OutputHookhandleSend in interface OutputHookmessage - The message that was sent.public void handleReceive(Object message)
InputHookhandleReceive in interface InputHookmessage - The message that was received.public void handleStop(Component subject)
ComponentHookhandleStop in interface ComponentHooksubject - The component that was stopped.Copyright © 2013-2014. All Rights Reserved.