Package com.tick42.glue.core.bus
Interface BusMessageHandler<T>
- Type Parameters:
T- the data type
- All Known Subinterfaces:
BusMessageHandler.Data<T>,BusMessageHandler.Event<T>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Handler for bus events.
BusMessageHandler<T> handler = (BusEvent<T> event, String topic) -> {
// handle event on topic
};
- Since:
- 1.6.0
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA convenient specialization ofBusMessageHandlerthat accepts only the data argument.static interfaceA convenient specialization ofBusMessageHandlerthat accepts only the event argument. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> BusMessageHandler<T> data(BusMessageHandler.Data<T> handler) Simplifies code when you have lambda or method reference that accepts <T>.static <T> BusMessageHandler<T> event(BusMessageHandler.Event<T> handler) Simplifies code when you have lambda or method reference that acceptsBusEvent<T>.void
-
Method Details
-
onMessage
- Parameters:
event- the bus eventtopic- the topic
-
event
Simplifies code when you have lambda or method reference that acceptsBusEvent<T>.BusMessageHandler<T> handler = BusMessageHandler.event((BusEvent<T> event) -> { // handle event });- Type Parameters:
T- the data type- Parameters:
handler- the handler- Returns:
- the handler
-
data
Simplifies code when you have lambda or method reference that accepts <T>.BusMessageHandler<T> handler = BusMessageHandler.data((T data) -> { // handle data });- Type Parameters:
T- the data type- Parameters:
handler- the handler- Returns:
- the handler
-