Hello, i am trying to create custom processor of listen tcp; My requirements
are:

The source system will create a connection and set a session; After a
session established, a message will be sent then my processor need to decode
the message, based on that decoded output, i need to create a response back
using the same socket; After reply has been sent, the socket will be closed
by the source system;

See, the client access my processor in one socket session one message style;
I can't use the built in ListenTCP since it doesn't have custom reply
response in same session (more specifically, same output stream) therefore i
need to make one.

My class structure is:

*ListenTCP - extends abstractProcessor*
This is the main processor, will instantiate and call ConcurrentListener()

*ConcurrentListener*
Setup and start the server socket and accept connection

*ConcurrentAdapterHandler*
Wrapper class for executing runnable ConcurentAdapter only, the idea is to
process the message in another thread and store Future object in a
concurrentLinkedQueue here; The Queue will be consumed in onTrigger() in
main processor class.

*ConcurrentAdapter*
Decode and send response back 

In my ListenTCP i implemented:

*@OnScheduled*
OnSchedule()
- Create and initialize server socket in separate runnable class and using
separate daemon thread to run it

OnTrigger()
- Get queue in class ConcurrentListener
- If queue > 0 then session.create() for createing new flow file and
session.transfer it else return;

The problem is, the message processed rate is very low compared with the
same code implemented in Spring Java style. Where is my mistake? My
understanding is:
onScheduled will be called once for every time i hit the start button at
nifi GUI
onTrigger will be called repeteadly and simultanously (based on how many
thread assigned in Nifi GUI)






-----

-----------------
Bobby
--
Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/

Reply via email to