[
https://issues.apache.org/jira/browse/NIFI-274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14978931#comment-14978931
]
Bryan Bende commented on NIFI-274:
----------------------------------
The overall intent was to have one background thread in the case of UDP, and
for TCP there would be a thread accepting connections and then up to 2 threads
reading from the channels. Both of these per instance of ListenSyslog.
I've gone through several refactorings of the listen processor, and thinking
about it now based on your comments, the DatagramChannelReader really doesn't
benefit from having the buffer pool since only one message can be read at a
time. Maybe it would be better for the reader to allocate a buffer up front as
a member variable of DatagraChannelReader and just use that? Same thing could
probably be done on the TCP side, one per SocketChannelReader? This would
definitely simplify things.
I'm not opposed to looking into the selector approach you outlined.
The intent for the TCP side of things was to keep reading from a long-lived
connection as long as it stays open, this is the outer while loop that reads
until -1 is returned from bytes read. There inner while loop reads until the
buffer is full, at which points it starts at the beginning of the buffer
writing bytes to the ByteArrayOutputstream until hitting a new line or the end
of the buffer. If it hits a new line it spawns off an event, resets the
outputstream and keeps going, if it doesn't the bytes of the partial event are
still in the outputstream so it is ok to return the buffer and read more.
I had tested the TCP side of things with rsyslogd, but also wrote a standalone
program to jam events in there:
https://github.com/bbende/syslog-producer/blob/master/src/main/java/org/logs/syslog/SyslogProducer.java
> Syslog processors
> -----------------
>
> Key: NIFI-274
> URL: https://issues.apache.org/jira/browse/NIFI-274
> Project: Apache NiFi
> Issue Type: New Feature
> Components: Extensions
> Affects Versions: 0.1.0
> Environment: any
> Reporter: Corey Flowers
> Assignee: Tony Kurc
> Priority: Minor
> Labels: features, syslog
> Fix For: 0.4.0
>
> Attachments: NIFI-274-2.patch, NIFI-274-3.patch, NIFI-274-4.patch,
> NIFI-274.patch, SyslogProcessorTesting.xml
>
>
> request to add syslog processors for direct interaction with syslog to
> include pulls and pushes of log info.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)