EntityMessageEndpoint

public abstract class EntityMessageEndpoint<I, E extends Entity<I, ? extends Object>, M extends SignalEnvelope<? extends Object, ? extends Object, ? extends Object>> extends AbstractMessageEndpoint<I, M>

Abstract base for endpoints handling messages sent to entities.

Loading and storing an entity is a tenant-sensitive operation, which must be performed under the context of the tenant ID in which the message we dispatch was originated.

Parameters

<I>

the type of entity IDs

<E>

the type of entities

<M>

the type of message envelopes

Inheritors

Constructors

Link copied to clipboard
protected void EntityMessageEndpoint(Repository<I, E> repository, M envelope)

Functions

Link copied to clipboard
protected abstract void afterDispatched(I entityId)
The callback invoked after the message is dispatched to an entity with the given ID.
Link copied to clipboard
protected abstract DispatchOutcome invokeDispatcher(E entity)
Invokes entity-specific method for dispatching the message.
Link copied to clipboard
protected abstract boolean isModified(E entity)
Verifies whether the entity was modified during the message dispatching.
Link copied to clipboard
protected abstract void onEmptyResult(E entity)
Allows derived classes to handle empty list of uncommitted events returned by the entity in response to the message.
Link copied to clipboard
protected abstract void onModified(E entity)
Callback to perform operations if the entity was modified during message dispatching.
Link copied to clipboard
public Repository<I, E> repository()
Obtains the parent repository of this endpoint.
Link copied to clipboard
protected final void store(E entity)
Stores the entity if it was modified during message dispatching.

Inherited functions

Link copied to clipboard
public final DispatchOutcome dispatchTo(I targetId)
Dispatches the message to the target with the passed ID.
Link copied to clipboard
protected final M envelope()
Obtains the envelope of the message processed by this endpoint.
Link copied to clipboard
public abstract void onDuplicate(I target, M envelope)
The callback invoked if the handled signal is a duplicate.
Link copied to clipboard
protected abstract DispatchOutcome performDispatch(I targetId)
Performs actual dispatching of the signal to the respective target by the passed ID.