public class HTTPEventAsyncConsumer extends com.streamscape.sdo.AbstractNamedObject implements EventAsyncConsumer
Title: HTTP Fabric Client
Description: This class provides the functionality of an asynchronous consumer of Fabric events.
Copyright: Copyright (c) 2011
Company: StreamScape Technologies
DEFAULT_CLOSE_TIMEOUT
DEFAULT_SERIAL_VERSION_ID
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clears the underlying event queue of the consumer.
|
void |
close() |
void |
close(long timeout)
Closes the consumer and drops it from the corresponding dispatcher.
|
void |
forceClose()
Forcibly closes the consumer and drops it from the corresponding dispatcher.
|
int |
getCurrentDepth()
Returns the current number of events in the underlying queue.
|
ConsumerState |
getCurrentState() |
DeliveryMode |
getDeliveryMode()
Returns a delivery mode of the underlying event queue.
|
long |
getDeliverySpinWait()
Returns a delivery delay (in milliseconds) of the underlying queue.
|
DispatchMode |
getDispatchMode()
Returns a dispatch mode of the consumer.
|
java.lang.String |
getEventFilter() |
FabricEventListener |
getEventListener()
Returns the event listener associated with the consumer.
|
EventScope |
getEventScope() |
java.lang.String |
getEventSelector() |
FlowControlMode |
getFlowControlMode()
Returns a flow control mode of the underlying queue.
|
java.lang.String |
getGroupName() |
int |
getMaxDepth()
Returns a maximum depth of the underlying queue.
|
boolean |
isStarted()
Checks if a delivery of events to the associated listener is started.
|
boolean |
isSuspended()
Checks if a delivery of events to the associated listener is suspended.
|
boolean |
matchesEventId(java.lang.String eventId) |
boolean |
noLocal() |
ImmutableEventDatagram |
receive() |
ImmutableEventDatagram |
receive(long waitTime) |
ImmutableEventDatagram |
receive(java.lang.String eventSelector) |
ImmutableEventDatagram |
receive(java.lang.String eventSelector,
long waitTime) |
ImmutableEventDatagram |
receiveNoWait() |
ImmutableEventDatagram |
receiveNoWait(java.lang.String eventSelector) |
void |
resume()
Resumes a delivery of events to the associated listener.
|
void |
setDeliveryMode(DeliveryMode deliveryMode)
Sets a delivery mode of the underlying event queue.
|
void |
setDeliverySpinWait(long deliverySpinWait)
Sets a delivery delay (in milliseconds) of the underlying queue.
|
void |
setEventListener(FabricEventListener listener)
Sets the event listener associated with the consumer.
|
void |
setEventSelector(java.lang.String eventSelector) |
void |
setFlowControlMode(FlowControlMode flowControlMode)
Sets a flow control mode of the underlying event queue.
|
void |
setMaxDepth(int maxDepth)
Sets a maximum depth of the underlying event queue.
|
void |
start()
Starts a delivery of events to the associated listener.
|
void |
stop()
Stops a delivery of events to the associated listener.
|
void |
suspend()
Suspends a delivery of events to the associated listener.
|
compareTo, equals, getName, toString
clone, getSerialVersionUID
getClass, hashCode, notify, notifyAll, wait, wait, wait
close
getDispatchMode, getEventFilter, getEventListener, getEventScope, getEventSelector, getGroupName, getName, noLocal, setEventListener, setEventSelector
public int getMaxDepth() throws HTTPFabricException
EventAsyncConsumer
getMaxDepth
in interface EventAsyncConsumer
HTTPFabricException
public void setMaxDepth(int maxDepth) throws HTTPFabricException
EventAsyncConsumer
100000
events. Once this
limit is reached, new inbound events will be handled based on the
FLOW CONTROL mode defined below.
This method must be invoked only for non-started consumer.
setMaxDepth
in interface EventAsyncConsumer
maxDepth
- int the maximum depth of the underlying queue to be set.HTTPFabricException
public FlowControlMode getFlowControlMode() throws HTTPFabricException
EventAsyncConsumer
getFlowControlMode
in interface EventAsyncConsumer
HTTPFabricException
public void setFlowControlMode(FlowControlMode flowControlMode) throws HTTPFabricException
EventAsyncConsumer
FlowControlMode.EXCEPTION
.
This method must be invoked only for non-started consumer.
setFlowControlMode
in interface EventAsyncConsumer
flowControlMode
- the flow control mode of the underlying queue to be set.HTTPFabricException
public DeliveryMode getDeliveryMode() throws HTTPFabricException
EventAsyncConsumer
getDeliveryMode
in interface EventAsyncConsumer
HTTPFabricException
public void setDeliveryMode(DeliveryMode deliveryMode) throws HTTPFabricException
EventAsyncConsumer
DeliveryMode.ASYNC_PACED
.
This method must be invoked only for non-started consumer.
setDeliveryMode
in interface EventAsyncConsumer
deliveryMode
- the delivery mode of the underlying queue to be set.HTTPFabricException
public long getDeliverySpinWait() throws HTTPFabricException
EventAsyncConsumer
getDeliverySpinWait
in interface EventAsyncConsumer
HTTPFabricException
public void setDeliverySpinWait(long deliverySpinWait) throws HTTPFabricException
EventAsyncConsumer
1
millisecond.
This method must be invoked only for non-started consumer.
setDeliverySpinWait
in interface EventAsyncConsumer
deliverySpinWait
- the delivery delay of the underlying queue.HTTPFabricException
public void start() throws HTTPFabricException
EventAsyncConsumer
start
in interface EventAsyncConsumer
HTTPFabricException
public void stop() throws HTTPFabricException
EventAsyncConsumer
stop
in interface EventAsyncConsumer
HTTPFabricException
public void suspend() throws HTTPFabricException
EventAsyncConsumer
suspend
in interface EventAsyncConsumer
HTTPFabricException
public void resume() throws HTTPFabricException
EventAsyncConsumer
resume
in interface EventAsyncConsumer
HTTPFabricException
public void clear() throws HTTPFabricException
EventAsyncConsumer
clear
in interface EventAsyncConsumer
HTTPFabricException
public int getCurrentDepth() throws HTTPFabricException
EventAsyncConsumer
getCurrentDepth
in interface EventAsyncConsumer
HTTPFabricException
public void close(long timeout) throws HTTPFabricException
EventAsyncConsumer
close
in interface EventAsyncConsumer
timeout
- the wait time (in milliseconds) for processing of all events in the queue before stopping the delivery thread.HTTPFabricException
public void forceClose()
EventAsyncConsumer
close(0)
.
Under normal circumstances the closing of a consumer that is asynchronous will wait for the underlying event queue primitive to complete delivery of all events. This may cause the closing to take longer then anticipated if there are many pending events. This method will discard all pending events and should be used with caution as it may result in unexpected behavior or data loss.
forceClose
in interface EventAsyncConsumer
public ImmutableEventDatagram receive() throws HTTPFabricException
HTTPFabricException
public ImmutableEventDatagram receive(long waitTime) throws HTTPFabricException
HTTPFabricException
public ImmutableEventDatagram receiveNoWait() throws HTTPFabricException
HTTPFabricException
public ImmutableEventDatagram receive(java.lang.String eventSelector) throws HTTPFabricException
HTTPFabricException
public ImmutableEventDatagram receive(java.lang.String eventSelector, long waitTime) throws HTTPFabricException
HTTPFabricException
public ImmutableEventDatagram receiveNoWait(java.lang.String eventSelector) throws HTTPFabricException
HTTPFabricException
public boolean isStarted()
EventAsyncConsumer
isStarted
in interface EventAsyncConsumer
true
the events delivery is started, false
otherwise.public boolean isSuspended()
EventAsyncConsumer
isSuspended
in interface EventAsyncConsumer
true
the events delivery is suspended, false
otherwise.public ConsumerState getCurrentState() throws HTTPFabricException
HTTPFabricException
public FabricEventListener getEventListener()
EventConsumer
getEventListener
in interface EventConsumer
public boolean matchesEventId(java.lang.String eventId) throws HTTPFabricException
HTTPFabricException
public void setEventListener(FabricEventListener listener)
EventConsumer
setEventListener
in interface EventConsumer
listener
- the event listener to be set.public DispatchMode getDispatchMode()
EventConsumer
getDispatchMode
in interface EventConsumer
public java.lang.String getEventFilter()
public java.lang.String getEventSelector()
public void setEventSelector(java.lang.String eventSelector) throws HTTPFabricException
HTTPFabricException
public void close() throws HTTPFabricException
HTTPFabricException
public EventScope getEventScope() throws HTTPFabricException
HTTPFabricException
public boolean noLocal() throws HTTPFabricException
HTTPFabricException
public java.lang.String getGroupName() throws HTTPFabricException
HTTPFabricException
Copyright © 2015-2024 StreamScape Technologies. All rights reserved.