Receive Task how possible for incoming TCP Stream


I am trying to receive a bytestream from a machine tcp client that sends all 15-30 seconds to my java tcp server. I get that bytestream, cache it in my application and then I want to send it back (till now hardcoded). Now I want to modell my Process something like:

process_receiving_msg_from_tcpclient.bpmn (3.5 KB)

I think I need a Java Class Execution as a Service Task for starting my TCP-Server, so far so nice. But then I need to wait the 15-30 seconds before my tcp client sends the bytestream I need. How can I modell this in Camunda Modeller and how I have to configure the Modell in Properties Panel, that I can wait the seconds and just if I received the bytestream going on and then I think I have to use the next Service Task for sending my bytestream to TCP Client. Am I on the right way with receive task ? Or is there a better solution for this?

The Receve task will wait forever until a message comes in to tell it to move forward. You might want to use a time to perhaps stop waiting if it’s been waiting too long or to re-send the request.
That would look something like this:

1 Like

Thats a good Supplement for my process.
But I do not know how I can configure the properties Panel in Modeller that it is waiting for the received message (bytestream) and then i can going on in Process (evaluating and send msg back to tcp client in Java Class).

Receive tasks specifically wait for BPMN messages you can find out more about how they work in this tutorial. The most important thing is that it’s asynchronous. I think if you’re looking for synchronous communication it might be best do it all inside a service task.

1 Like

The first step will be a synchronous communication. So you want to say that I dont need that Receive task (for wait for message comes in from tcp client) in first step ? I have the Process running now in one Java Class (hardcoded) but I want to split it, so that I am more flexible and in my next steps I can add Exclusive Gateways and modifying the received messages from incoming bytestream. Can you send a BPMN, how you would say would be the first step.
Because for Startevent -> (Service Task) run one Process in Java Class -> End event, I won’t need a BPMN. The goal is to split it a bit more and be more flexible in later additions to process.