com.netflix.eventbus.spi
Class CatchAllSubscriber

java.lang.Object
  extended by com.netflix.eventbus.spi.CatchAllSubscriber

public final class CatchAllSubscriber
extends java.lang.Object

A special subscriber that receives all events published to EventBus. This is always registered with eventbus but is disabled. In order to enable this subscriber call EventBus.enableCatchAllSubscriber(java.util.concurrent.BlockingQueue) with the sink (receiver) for all events.
This subscriber will only call BlockingQueue.offer(Object) on this sink to avoid any sort of blocking. Any events for which the offer call fails are rejected.
As any other EventBus subscriber, this subscriber is async i.e. any events received by this subscriber are pushed by the eventbus in async mode. The queue size for this is SUBSCRIBER_QUEUE_SIZE and there is no batching done for events to reduce memory overheads.


Field Summary
static int SUBSCRIBER_QUEUE_SIZE
           
 
Constructor Summary
CatchAllSubscriber()
           
 
Method Summary
 void disable()
           
 boolean enable(java.util.concurrent.BlockingQueue sink)
           
 boolean isEnabled()
           
 void receive(java.lang.Object event)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUBSCRIBER_QUEUE_SIZE

public static final int SUBSCRIBER_QUEUE_SIZE
See Also:
Constant Field Values
Constructor Detail

CatchAllSubscriber

public CatchAllSubscriber()
Method Detail

receive

public void receive(java.lang.Object event)

enable

public boolean enable(java.util.concurrent.BlockingQueue sink)

disable

public void disable()

isEnabled

public boolean isEnabled()