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 void
close()
Closes all emitters that the SwitchingEmitter usesvoid
emit(Event event)
Emit an event.void
flush()
Triggers this emitter to tell all emitters that this uses to flush.void
start()
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 IOException
Triggers this emitter to tell all emitters that this uses to flush.- Specified by:
flush
in interfaceEmitter
- Specified by:
flush
in interfaceFlushable
- Throws:
IOException
-
close
public void close() throws IOException
Closes all emitters that the SwitchingEmitter uses- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceEmitter
- Throws:
IOException
-
-