public class EmitterConfiguration
extends java.lang.Object
Constructor and Description |
---|
EmitterConfiguration()
Create an EmitterConfiguration instance.
|
Modifier and Type | Method and Description |
---|---|
EmitterConfiguration |
batchSize(int batchSize)
The default batch size is 50.
|
EmitterConfiguration |
bufferCapacity(int bufferCapacity)
The default buffer capacity is 10 000 events.
|
EmitterConfiguration |
callback(EmitterCallback callback)
Provide a custom EmitterCallback to access successfully sent or failed event payloads.
|
EmitterConfiguration |
customRetryForStatusCodes(java.util.Map<java.lang.Integer,java.lang.Boolean> customRetryForStatusCodes)
Set custom retry rules for HTTP status codes received in emit responses from the Collector.
|
EmitterConfiguration |
eventStore(EventStore eventStore)
The default EventStore is InMemoryEventStore.
|
int |
getBatchSize()
Returns the number of events to send per request (batched).
|
int |
getBufferCapacity()
Returns the maximum number of events to buffer in memory.
|
EmitterCallback |
getCallback()
Returns the custom callback which is called when events are successfully sent to the collector,
or after certain failure conditions.
|
java.util.Map<java.lang.Integer,java.lang.Boolean> |
getCustomRetryForStatusCodes()
Returns the custom configuration for HTTP status codes.
|
EventStore |
getEventStore()
Returns the EventStore used to buffer events.
|
java.util.concurrent.ScheduledExecutorService |
getRequestExecutorService()
Returns the ScheduledExecutorService used for sending events.
|
int |
getThreadCount()
Returns the number of threads used for event sending using the ScheduledExecutorService.
|
EmitterConfiguration |
requestExecutorService(java.util.concurrent.ScheduledExecutorService requestExecutorService)
Set a custom ScheduledExecutorService to send http requests (default is ScheduledThreadPoolExecutor).
|
EmitterConfiguration |
threadCount(int threadCount)
Sets the Thread Count for the ScheduledExecutorService (default is 50).
|
public EmitterConfiguration()
public int getBatchSize()
public int getBufferCapacity()
public EventStore getEventStore()
public java.util.Map<java.lang.Integer,java.lang.Boolean> getCustomRetryForStatusCodes()
public int getThreadCount()
public java.util.concurrent.ScheduledExecutorService getRequestExecutorService()
public EmitterCallback getCallback()
public EmitterConfiguration batchSize(int batchSize)
batchSize
- The count of events to send in one HTTP requestpublic EmitterConfiguration bufferCapacity(int bufferCapacity)
bufferCapacity
- The maximum capacity of the default InMemoryEventStore event bufferpublic EmitterConfiguration eventStore(EventStore eventStore)
eventStore
- The EventStore to usepublic EmitterConfiguration customRetryForStatusCodes(java.util.Map<java.lang.Integer,java.lang.Boolean> customRetryForStatusCodes)
customRetryForStatusCodes
- Mapping of integers (status codes) to booleans (true for retry and false for not retry)public EmitterConfiguration threadCount(int threadCount)
threadCount
- the size of the thread poolpublic EmitterConfiguration requestExecutorService(java.util.concurrent.ScheduledExecutorService requestExecutorService)
Implementation note: Be aware that calling `close()` on a BatchEmitter instance has a side-effect and will shutdown that ExecutorService.
requestExecutorService
- the ScheduledExecutorService to usepublic EmitterConfiguration callback(EmitterCallback callback)
callback
- an EmitterCallback