Class SwitchingEmitter
- java.lang.Object
-
- org.apache.druid.java.util.emitter.core.SwitchingEmitter
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes all emitters that the SwitchingEmitter usesvoidemit(Event event)Emit an event.voidflush()Triggers this emitter to tell all emitters that this uses to flush.voidstart()Start the emitter.
-
-
-
Constructor Detail
-
SwitchingEmitter
public SwitchingEmitter(Map<String,List<Emitter>> feedToEmitters, Emitter[] defaultEmitter)
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 Detail
-
start
public void start()
Start the emitter. This will start all the emitters the SwitchingEmitter uses.
-
emit
public void emit(Event event)
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
public void flush() throws IOExceptionTriggers this emitter to tell all emitters that this uses to flush.- Specified by:
flushin interfaceEmitter- Specified by:
flushin interfaceFlushable- Throws:
IOException
-
close
public void close() throws IOExceptionCloses all emitters that the SwitchingEmitter uses- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceEmitter- Throws:
IOException
-
-