Class: EventSubscriptionRequest

EventSubscriptionRequest(eventTypenon-null, clientnon-null, actorRequestFactorynon-null)

A request to subscribe to events of a certain type. Allows to obtain the `EventSubscriptionObject` which reflects the events that happened in the system and match the subscription criteria. A usage example: ``` client.subscribeToEvent(TaskCreated.class) .where([Filters.eq("task_priority", Task.Priority.HIGH), Filters.eq("context.past_message.actor_context.actor", userId)]) .post() .then(({eventEmitted, unsubscribe}) => { eventEmitted.subscribe(_logEvent); }); ``` The fields specified to the `where` filters should either be a part of the event message or have a `context.` prefix and address one of the fields of the `EventContext` type. The `eventEmitted` observable reflects all events that occurred in the system and match the subscription criteria, in a form of `spine.core.Event`. Please note that the subscription object should be manually unsubscribed when it's no longer needed to receive the updates. This can be done with the help of `unsubscribe` callback.

Constructor

new EventSubscriptionRequest(eventTypenon-null, clientnon-null, actorRequestFactorynon-null)

Parameters:
Name Type Description
eventType Class.<Message> the target event type
client Client the client which initiated the request
actorRequestFactory ActorRequestFactory the request factory
Source:

Classes

EventSubscriptionRequest

Methods

_self()

Source:

_subscribe() → {Promise.<EventSubscriptionObject>}

Source:
Returns:
Type
Promise.<EventSubscriptionObject>