public final class DispatchMode
extends java.lang.Enum
Title: Service Event Fabric Core
Description:
This class presents enumerated modes for constructing dispatcher event consumers. There are two basic modes of event processing: Synchronous and Asynchronous. In synchronous mode events are dispatched directly by passing the arriving event to all the consumer objects. In asynchronous mode events are put into a backing event queue that is part of the consumer interface. Both mechanisms have their merits as explained below:
ASYNC In this mode the event is put on an event queue and the invoker returns immediately. The actual event is queued up for delivery and handled by the dispatcher in an asynchronous but serial fashion. This mode guarantees that events are processed in the order in which they are received (unless selectively removed by the consumer). In most cases this mode results in better throughput at the expense of introducing some latency into the operation. This mode also makes the assumption that a consumer is processing volatile events, wherein data loss is acceptable.
In situations where a Hosting Container
experiences a failure all enqueued events are lost.
The dispatch mechanisms function independent of any communication protocol by buffering datagrams in memory.
The mechanism provides for a configurable buffer as well as a delivery interval at which events are scheduled to
be delivered, resulting in a delivery loop cycle. This mechanism may be combined with Quality of Service
settings in the Service Event Fabric
allowing for some fault tolerance and recovery. This mechanism
implicitly creates one delivery thread per consumer.
DIRECT Invokes the given Event Consumer
callback and blocks waiting for the underlying method to return.
Events are processed synchronously in the order they are received.
This mode results in direct dispatch which has minimal latency.
When the event dispatcher delivers the event the method blocks until all consumers receive the data. It does not use
or spawn additional threads. This has the effect of pushing back on the event producer, but it also ensures that exactly
one event is in process during any given failure. Synchronous execution may be combined with synchronous communication
protocols for improved Quality of Service
.
Copyright: Copyright (c) 2010
Company: StreamScape Technologies
Modifier and Type | Field and Description |
---|---|
static DispatchMode |
ASYNC |
static DispatchMode |
DIRECT |
Modifier and Type | Method and Description |
---|---|
static DispatchMode |
valueOf(java.lang.String name) |
static DispatchMode[] |
values() |
public static final DispatchMode ASYNC
public static final DispatchMode DIRECT
public static DispatchMode[] values()
public static DispatchMode valueOf(java.lang.String name)
Copyright © 2015-2024 StreamScape Technologies. All rights reserved.