Class SwitchingEmitter
java.lang.Object
org.apache.druid.java.util.emitter.core.SwitchingEmitter
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,Emitter
An emitter than that offers the ability to direct an event to multiple emitters based on the event's feed.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
SwitchingEmitter
Constructor for the SwitchingEmitter- Parameters:
feedToEmitters- Map of feed to a list of emitters that correspond to each feed,defaultEmitter- A list of emitters to use if there isn't a match of feed to an emitter
-
-
Method Details
-
start
public void start()Start the emitter. This will start all the emitters the SwitchingEmitter uses. -
emit
Emit an event. This method must not throw exceptions or block. The emitters that this uses must also not throw exceptions or block.This emitter will direct events based on feed to a list of emitters specified. If there is no match the event will use a list of default emitters instead.
Emitters that this emitter uses that receive too many events and internal queues fill up, should drop events rather than blocking or consuming excessive memory.
If an emitter that this emitter uses receives input it considers to be invalid, or has an internal problem, it should deal with that by logging a warning rather than throwing an exception. Emitters that log warnings should consider throttling warnings to avoid excessive logs, since a busy Druid cluster can emit a high volume of events.
-
flush
Triggers this emitter to tell all emitters that this uses to flush.- Specified by:
flushin interfaceEmitter- Specified by:
flushin interfaceFlushable- Throws:
IOException
-
close
Closes all emitters that the SwitchingEmitter uses- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceEmitter- Throws:
IOException
-