I am using the “Send event service task” and the “Receive task” to send and receive messages in an asynchronous way through a Kafka topic. See screenshot.
I was wondering if this is necessary/useful to have a connection (arrow) between those 2 tasks since the receiveTask has both channel key and event key defined and “knows” from whom to get the message.
Is there a point to do this? Can we omit this link?
In your scenario I think you still the need the link as this tells Flowable your desired processing sequence, even though the workflow would hit a “wait point” waiting for the message. That said, it is possible to structure the message reception and processing differently. For example the message reception and processing could be structured as a boundary event or you could build a message driven workflow with a message start event. You would need to consider the trade offs and benefits of each approach depending on your application needs.
I found this thread when I was looking for an example of how to produce a Kafka message using Flowable. My strategy, at the moment, is to have a service task that calls a method in a Spring bean that has a KafkaTemplate injected. This bean does all the job, basically. I wonder if this is the best strategy or if I should send the message using a “Send Event Task” directly somehow.
Looking at the diagram, I see that you used the “Send Event Task”. Do you happen to have the example still available? Thanks!