Reputation: 3270
I am going to read all streams in a TCP socket in network. the standard ListenTCP split streams based on \n (hard-coded). How I can write a custom ListenTCP processor in NiFi.
Do i need to extends AbstractListenEventProcessor? I rewrite all ListenTCP processor but it does not work.
Upvotes: 0
Views: 1715
Reputation: 18670
There is a JIRA for the processor to allow setting a configurable message delimiter: https://issues.apache.org/jira/browse/NIFI-1985
In order to implement this you need to modify the socket handlers that read the messages. The relevant code is here:
And the same thing for SSL:
It would be fairly easy to make the two handlers take the byte delimiter in the constructor, store it in a member variable, and then return that from getDelimiter(), and then you would have to get that byte passed all the way from the processor to when it creates the handler.
If you want to use more then one byte as a delimiter then it will be a little more challenging to do the comparison.
Upvotes: 1