public class SyslogReceiverNioDisruptorImpl extends Object implements SyslogReceiver
SyslogReceiver
uses multithreaded NIO to
handle socket receive() calls and then uses an LMAX disruptor ring buffer
to store the packet data. The packets are then decoded using async
CompletableFuture
calls that are executed on a set of ExecutorService
thread pools.Modifier and Type | Field and Description |
---|---|
static int |
EVENT_CONVERSION_TASK_QUEUE_SIZE
This is the size of the LMAX Disruptor queue that contains
SyslogConnection
tasks that will convert the syslog bytes into OpenNMS events. |
static int |
EVENT_PARSER_THREADS
This is the number of threads that are used to parse syslog messages into
OpenNMS events.
|
static int |
EVENT_SENDER_THREADS
This is the number of threads that are used to broadcast the OpenNMS events.
|
static int |
MAX_PACKET_SIZE
This size is used as the size of each
ByteBuffer used to capture syslog
messages. |
static int |
SOCKET_BYTE_BUFFER_QUEUE_SIZE
This is the size of the LMAX Disruptor queue that contains preallocated
ByteBufferMessage instances. |
static int |
SOCKET_RECEIVER_THREADS
This is the number of NIO listener threads that will process
DatagramChannel.receive(ByteBuffer)
calls on the syslog port. |
Constructor and Description |
---|
SyslogReceiverNioDisruptorImpl(SyslogdConfig config)
Construct a new receiver
|
Modifier and Type | Method and Description |
---|---|
ExecutorFactory |
getExecutorFactory() |
String |
getName() |
static DatagramChannel |
openChannel(SyslogdConfig config) |
void |
run()
The execution context.
|
void |
setExecutorFactory(ExecutorFactory executorFactory) |
void |
stop()
stop the current receiver
|
public static final int MAX_PACKET_SIZE
ByteBuffer
used to capture syslog
messages.
TODO: Make this configurablepublic static final int SOCKET_RECEIVER_THREADS
DatagramChannel.receive(ByteBuffer)
calls on the syslog port.
TODO: Make this configurablepublic static final int EVENT_PARSER_THREADS
public static final int EVENT_SENDER_THREADS
public static final int SOCKET_BYTE_BUFFER_QUEUE_SIZE
ByteBufferMessage
instances. This is the number of simultaneous
messages that can be in-flight at any given time.
TODO: Make this configurablepublic static final int EVENT_CONVERSION_TASK_QUEUE_SIZE
SyslogConnection
tasks that will convert the syslog bytes into OpenNMS events.
TODO: Make this configurablepublic SyslogReceiverNioDisruptorImpl(SyslogdConfig config) throws SocketException, IOException
sock
- matchPattern
- hostGroup
- messageGroup
- SocketException
IOException
public static DatagramChannel openChannel(SyslogdConfig config) throws SocketException, IOException
SocketException
IOException
public String getName()
getName
in interface SyslogReceiver
public ExecutorFactory getExecutorFactory()
public void setExecutorFactory(ExecutorFactory executorFactory)
public void stop() throws InterruptedException
stop
in interface SyslogReceiver
InterruptedException
public void run()
run
in interface Runnable
run
in interface SyslogReceiver
Copyright © 2017. All rights reserved.