Handle Race conditions

Hi @Tushar_Kapadnis

This is quite a common problem when working with Kafka, the engine is transactional and so does a lot more per request than kafka. Luckily there’s a pretty simple solution that you can implement in two steps

Step One

Make sure you’re model waiting for a response before you send your message to kafka. This can be done with a parallel gateway

Step Two

Make sure the engine commits it’s state before sending a message to Kafka. This is done by selecting the Send Message to Kafkatask and ticking the async before tickbox.

What this will achieve is that Camunda will commit it’s state including waiting for the message before a message is sent to kafka so there’s no longer a fear that the response will be too fast.

3 Likes