EventSubscriptionRequest
public final class EventSubscriptionRequest<E extends EventMessage> extends SubscribingRequest<M, C, W, B>
Allows to subscribe to events using filtering conditions.
Similarly to subscriptions to entity states, event subscriptions may use filtering by values of the proto types of subscribed messages:
clientRequest.subscribeToEvent(MyEventMessage.class)
.where(eq(MyEventMessage.Field.myProtoField(), fieldValue))
.observe((event, context) -> {...})
.post();
Content copied to clipboard
In addition to regular filtering conditions, event subscription requests may also reference fields of spine.core.EventContext
. For example, in order to filter events originate from commands of the given user, please use the following code:
clientRequest.subscribeToEvent(MyEventMessage.class)
.where(eq(EventContext.Field.pastMessage().actorContext().actor(), userId))
.observe((event, context) -> {...})
.post();
Content copied to clipboard
Parameters
<E>
the type of the event messages
Functions
Inherited functions
Link copied to clipboard
Creates a builder for customizing command request.
Link copied to clipboard
Assigns a handler for an error that may occur in the code of one of the consumers.
Link copied to clipboard
Assigns a handler for an error occurred on the server-side (such as validation error) in response to posting a request.
Link copied to clipboard
Assigns a handler for errors occurred when delivering messages from the server.
Assigns a handler for the error reported to onError of the StreamObserver responsible for delivering messages to the consumers.
Link copied to clipboard
Creates a builder for customizing subscription for the passed entity state type.
Link copied to clipboard
Creates a builder for customizing subscription for the passed event type.
Link copied to clipboard
Configures the request to return results matching all the passed filters.