Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.3k
Description
I want to use the Inbox/Outbox pattern, and I need the database commit and Kafka ack to happen within the same transaction. In the current implementation of the Kafka package, I can’t achieve this.
For the Inbox, I need to use manual ack mode.
I can use theBeforeConsume event to start a new transaction.
I can use theFailToConsume event to roll back the transaction if my handler fails.
I can use theAfterConsume event to commit the transaction if the handler and ack complete successfully.
However, I have no way to roll back the transaction if the ack fails. This would result in my database transaction remaining open until it times out.
https://github.com/hyperf/hyperf/blob/master/src/kafka/src/ConsumerManager.php#L122