unicast

public EventRouting<I> unicast<E extends EventMessage>(Class<E> eventType, Function<E, I> via)

Sets a custom route for the passed event type by obtaining the target entity ID from the passed function.

This is a convenience method for configuring routing when an event is to be delivered to only one entity which ID is calculated from the event message. A simplest case of that would be passing a method reference for an accessor of a field of the event message which contains the ID of interest.

Return

this to allow chained calls when configuring routing

Parameters

eventType

the type of the event to route

via

the function for obtaining the target entity ID

<E>

the type of the event message

See also


public EventRouting<I> unicast<E extends EventMessage>(Class<E> eventType, BiFunction<E, EventContext, I> via)

Sets a custom route for the passed event type by obtaining the target entity ID from the passed function over event message and its context.

This is a convenience method for configuring routing when an event is to be delivered to only one entity which ID is calculated from the event message and its context.

Return

this to allow chained calls when configuring routing

Parameters

eventType

the type of the event to route

via

the supplier of the target entity ID

<E>

the type of the event message

See also