trait EventSubscriber extends AnyRef
An EventSubscriber interface to subscribe events. The events can be subscribed on csw.params.events.EventKey. All events published on this key will be received by subscribers.
- Alphabetic
- By Inheritance
- EventSubscriber
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def get(eventKey: EventKey): Future[Event]
Get latest event for the given Event Key.
Get latest event for the given Event Key. If an event is not published for any eventKey, then
invalid event
is returned for that Event Key.In case the underlying server is not available, the future fails with csw.event.api.exceptions.EventServerNotAvailable exception. In all other cases of exception, the future fails with the respective exception
- eventKey
an csw.params.events.EventKey to subscribe to
- returns
a future which completes with the latest csw.params.events.Event for the provided Event Key
- abstract def get(eventKeys: Set[EventKey]): Future[Set[Event]]
Get latest events for multiple Event Keys.
Get latest events for multiple Event Keys. The latest events available for the given Event Keys will be received first. If event is not published for one or more event keys,
invalid event
will be received for those Event Keys.In case the underlying server is not available, the future fails with csw.event.api.exceptions.EventServerNotAvailable exception. In all other cases of exception, the future fails with the respective exception
- eventKeys
a set of csw.params.events.EventKey to subscribe to
- returns
a future which completes with a set of latest csw.params.events.Event for the provided Event Keys
- abstract def pSubscribe(subsystem: Subsystem, pattern: String): Source[Event, EventSubscription]
Subscribe to events from Event Keys specified using a subsystem and a pattern to match the remaining Event Key.
Subscribe to events from Event Keys specified using a subsystem and a pattern to match the remaining Event Key. The latest events available for the given Event Keys will be received first. If event is not published for one or more event keys,
invalid event
will be received for those Event Keys.At the time of invocation, in case the underlying server is not available, csw.event.api.exceptions.EventServerNotAvailable exception is thrown and the subscription is stopped after logging appropriately. csw.event.api.scaladsl.EventSubscription!.ready method can be used to determine this state. In all other cases of exception, the subscription resumes to receive remaining elements.
- subsystem
a valid
Subsystem
which represents the source of the events- pattern
Subscribes the client to the given patterns. Supported glob-style patterns:
- h?llo subscribes to hello, hallo and hxllo
- h*llo subscribes to hllo and heeeello
- h[ae]llo subscribes to hello and hallo, but not hillo Use \ to escape special characters if you want to match them verbatim.
- returns
a akka.stream.scaladsl.Source of csw.params.events.Event. The materialized value of the source provides an csw.event.api.scaladsl.EventSubscription which can be used to unsubscribe from all the Event Keys which were subscribed to
- abstract def pSubscribeCallback(subsystem: Subsystem, pattern: String, callback: (Event) => Unit): EventSubscription
Subscribes a callback to events from Event Keys specified using a subsystem and a pattern to match the remaining Event Key.
Subscribes a callback to events from Event Keys specified using a subsystem and a pattern to match the remaining Event Key.
The latest events available for the given Event Keys will be received first. If event is not published for one or more event keys,
invalid event
will be received for those Event Keys.At the time of invocation, in case the underlying server is not available, csw.event.api.exceptions.EventServerNotAvailable exception is thrown and the subscription is stopped after logging appropriately. csw.event.api.scaladsl.EventSubscription!.ready method can be used to determine this state. In all other cases of exception, the subscription resumes to receive remaining elements.
- subsystem
a valid
Subsystem
which represents the source of the events- pattern
Subscribes the client to the given patterns. Supported glob-style patterns: - h?llo subscribes to hello, hallo and hxllo - h*llo subscribes to hllo and heeeello - h[ae]llo subscribes to hello and hallo, but not hillo Use \ to escape special characters if you want to match them verbatim.
- callback
a function to execute on each received event
- returns
an csw.event.api.scaladsl.EventSubscription which can be used to unsubscribe from all the Event Keys which were subscribed to
- Note
Callbacks are not thread-safe on the JVM. If you are doing side effects/mutations inside the callback, you should ensure that it is done in a thread-safe way inside an actor.
- abstract def subscribe(eventKeys: Set[EventKey], every: FiniteDuration, mode: SubscriptionMode): Source[Event, EventSubscription]
Subscribe to multiple eventKeys and receive events at
every
frequency according to the specifiedmode
(RateAdapter or RateLimiter).Subscribe to multiple eventKeys and receive events at
every
frequency according to the specifiedmode
(RateAdapter or RateLimiter). The latest events available for the given Event Keys will be received first. If event is not published for one or more event keys,invalid event
will be received for those Event Keys.At the time of invocation, in case the underlying server is not available, csw.event.api.exceptions.EventServerNotAvailable exception is thrown and the stream is stopped after logging appropriately. In all other cases of exception, as per the default behavior, the stream will stop. To avoid that, user should provide a resuming materializer while running the stream.
- eventKeys
a set of csw.params.events.EventKey to subscribe to
- every
the duration which determines the frequency with which events are received
- mode
an appropriate csw.event.api.scaladsl.SubscriptionMode to control the behavior of rate of events w.r.t. the given frequency. Refer the API documentation for SubscriptionMode for more details
- returns
a akka.stream.scaladsl.Source of csw.params.events.Event. The materialized value of the source provides an csw.event.api.scaladsl.EventSubscription which can be used to unsubscribe from all the Event Keys which were subscribed to
- Note
All the other APIs of csw.event.api.scaladsl.EventSubscriber that do not return a akka.stream.scaladsl.Source, internally use the resuming materializer which will ignore the failed event and resume receiving further events.
- abstract def subscribe(eventKeys: Set[EventKey]): Source[Event, EventSubscription]
Subscribe to multiple Event Keys and get a single stream of events for all event keys.
Subscribe to multiple Event Keys and get a single stream of events for all event keys. The latest events available for the given Event Keys will be received first. If event is not published for one or more event keys,
invalid event
will be received for those Event Keys.At the time of invocation, in case the underlying server is not available csw.event.api.exceptions.EventServerNotAvailable exception is thrown and the stream is stopped after logging appropriately. In all other cases of exception, as per the default behavior, the stream will stop. To avoid that, user should provide a resuming materializer while running the stream.
- eventKeys
a set of csw.params.events.EventKey to subscribe to
- returns
a akka.stream.scaladsl.Source of csw.params.events.Event. The materialized value of the source provides an csw.event.api.scaladsl.EventSubscription which can be used to unsubscribe from all the Event Keys which were subscribed to
- Note
All the other APIs of csw.event.api.scaladsl.EventSubscriber that do not return a akka.stream.scaladsl.Source, internally use the resuming materializer which will ignore the failed event and resume receiving further events.
- abstract def subscribeActorRef(eventKeys: Set[EventKey], actorRef: ActorRef[Event], every: FiniteDuration, mode: SubscriptionMode): EventSubscription
Overload for above
subscribeActorRef
for receiving event at aevery
frequency according to the specifiedmode
.Overload for above
subscribeActorRef
for receiving event at aevery
frequency according to the specifiedmode
. The latest events available for the given Event Keys will be received first. If event is not published for one or more event keys,invalid event
will be received for those Event Keys.At the time of invocation, in case the underlying server is not available, csw.event.api.exceptions.EventServerNotAvailable exception is thrown and the subscription is stopped after logging appropriately. csw.event.api.scaladsl.EventSubscription!.ready method can be used to determine this state. In all other cases of exception, the subscription resumes to receive remaining elements.
- eventKeys
a set of csw.params.events.EventKey to subscribe to
- actorRef
an actorRef of an actor to which each received event is redirected
- every
the duration which determines the frequency with which events are received
- mode
an appropriate csw.event.api.scaladsl.SubscriptionMode to control the behavior of rate of events w.r.t. the given frequency. Refer the API documentation for SubscriptionMode for more details
- returns
an csw.event.api.scaladsl.EventSubscription which can be used to unsubscribe from all the Event Keys which were subscribed to
- abstract def subscribeActorRef(eventKeys: Set[EventKey], actorRef: ActorRef[Event]): EventSubscription
Subscribes an actor to events from multiple event keys.
Subscribes an actor to events from multiple event keys. The latest events available for the given Event Keys will be received first. If event is not published for one or more event keys,
invalid event
will be received for those Event Keys.At the time of invocation, in case the underlying server is not available, csw.event.api.exceptions.EventServerNotAvailable exception is thrown and the subscription is stopped after logging appropriately. csw.event.api.scaladsl.EventSubscription!.ready method can be used to determine this state. In all other cases of exception, the subscription resumes to receive remaining elements.
- eventKeys
a set of csw.params.events.EventKey to subscribe to
- actorRef
an actorRef of an actor which handles each received event
- returns
an csw.event.api.scaladsl.EventSubscription which can be used to unsubscribe from all the Event Keys which were subscribed to
- abstract def subscribeAsync(eventKeys: Set[EventKey], callback: (Event) => Future[_], every: FiniteDuration, mode: SubscriptionMode): EventSubscription
Overload for above
subscribeAsync
for receiving event at aevery
frequency according to the specifiedmode
.Overload for above
subscribeAsync
for receiving event at aevery
frequency according to the specifiedmode
. The latest events available for the given Event Keys will be received first. If event is not published for one or more event keys,invalid event
will be received for those Event Keys.At the time of invocation, in case the underlying server is not available, csw.event.api.exceptions.EventServerNotAvailable exception is thrown and the subscription is stopped after logging appropriately. csw.event.api.scaladsl.EventSubscription!.ready method can be used to determine this state. In all other cases of exception, the subscription resumes to receive remaining elements.
- eventKeys
a set of csw.params.events.EventKey to subscribe to
- callback
a function to execute on each received event
- every
the duration which determines the frequency with which events are received
- mode
an appropriate csw.event.api.scaladsl.SubscriptionMode to control the behavior of rate of events w.r.t. the given frequency. Refer the API documentation for SubscriptionMode for more details
- returns
an csw.event.api.scaladsl.EventSubscription which can be used to unsubscribe from all the Event Keys which were subscribed to
- abstract def subscribeAsync(eventKeys: Set[EventKey], callback: (Event) => Future[_]): EventSubscription
Subscribes an asynchronous callback function to events from multiple eventKeys.
Subscribes an asynchronous callback function to events from multiple eventKeys. The callback is of type event => future and it ensures that the event callbacks are called sequentially in such a way that the subsequent execution will start only after the prior one completes. This API gives the guarantee of ordered execution of the asynchronous callbacks.
The latest events available for the given Event Keys will be received first. If event is not published for one or more event keys,
invalid event
will be received for those Event Keys.At the time of invocation, in case the underlying server is not available, csw.event.api.exceptions.EventServerNotAvailable exception is thrown and the subscription is stopped after logging appropriately. csw.event.api.scaladsl.EventSubscription!.ready method can be used to determine this state. In all other cases of exception, the subscription resumes to receive remaining elements.
- eventKeys
a set of csw.params.events.EventKey to subscribe to
- callback
a function to execute asynchronously on each received event
- returns
an csw.event.api.scaladsl.EventSubscription which can be used to unsubscribe from all the Event Keys which were subscribed to
- Note
Callbacks are not thread-safe on the JVM. If you need to do side effects/mutations, prefer using
subscribeActorRef
API.
- abstract def subscribeCallback(eventKeys: Set[EventKey], callback: (Event) => Unit, every: FiniteDuration, mode: SubscriptionMode): EventSubscription
Overload for above
subscribeCallback
for receiving event at aevery
frequency according to the specifiedmode
.Overload for above
subscribeCallback
for receiving event at aevery
frequency according to the specifiedmode
. The latest events available for the given Event Keys will be received first. If event is not published for one or more event keys,invalid event
will be received for those Event Keys.At the time of invocation, in case the underlying server is not available, csw.event.api.exceptions.EventServerNotAvailable exception is thrown and the subscription is stopped after logging appropriately. csw.event.api.scaladsl.EventSubscription!.ready method can be used to determine this state. In all other cases of exception, the subscription resumes to receive remaining elements.
- eventKeys
a set of csw.params.events.EventKey to subscribe to
- callback
a function to execute on each received event
- every
the duration which determines the frequency with which events are received
- mode
an appropriate csw.event.api.scaladsl.SubscriptionMode to control the behavior of rate of events w.r.t. the given frequency. Refer the API documentation for SubscriptionMode for more details
- returns
an csw.event.api.scaladsl.EventSubscription which can be used to unsubscribe from all the Event Keys which were subscribed to
- abstract def subscribeCallback(eventKeys: Set[EventKey], callback: (Event) => Unit): EventSubscription
Subscribes a callback function to events from multiple event keys.
Subscribes a callback function to events from multiple event keys. The latest events available for the given Event Keys will be received first. If event is not published for one or more event keys,
invalid event
will be received for those Event Keys.At the time of invocation, in case the underlying server is not available, csw.event.api.exceptions.EventServerNotAvailable exception is thrown and the subscription is stopped after logging appropriately. csw.event.api.scaladsl.EventSubscription!.ready method can be used to determine this state. In all other cases of exception, the subscription resumes to receive remaining elements.
- eventKeys
a set of csw.params.events.EventKey to subscribe to
- callback
a function to execute on each received event
- returns
an csw.event.api.scaladsl.EventSubscription which can be used to unsubscribe from all the Event Keys which were subscribed to
- Note
Callbacks are not thread-safe on the JVM. If you need to do side effects/mutations, prefer using
subscribeActorRef
API. Also note that any exception thrown fromcallback
is expected to be handled by the component developers.
- abstract def subscribeObserveEvents(): Source[Event, EventSubscription]
************ IMPORTANT ************ This API uses redis pattern subscription.
************ IMPORTANT ************ This API uses redis pattern subscription. Having many live pattern subscriptions causes overall latency degradation. Prefer subscribe API over this whenever possible. *********** ********* ************
Subscribe to all the observe events
At the time of invocation, in case the underlying server is not available, csw.event.api.exceptions.EventServerNotAvailable exception is thrown and the subscription is stopped after logging appropriately. csw.event.api.scaladsl.EventSubscription!.ready method can be used to determine this state. In all other cases of exception, the subscription resumes to receive remaining elements.
- returns
a akka.stream.scaladsl.Source of csw.params.events.Event. The materialized value of the source provides an csw.event.api.scaladsl.EventSubscription which can be used to unsubscribe from observe events subscription
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])