Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Transactional producer - messages are being wrongly committed #119

Open
im-konge opened this issue Jan 31, 2025 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@im-konge
Copy link
Member

im-konge commented Jan 31, 2025

Current implementation of the Kafka producer is wrong when using the transactional producer.
Originally, we had implemented that the messages are committed every X messages (which is configurable using MESSAGES_PER_TRANSACTION).

But, this generates following error:

2025-01-30 15:26:25.183.18688423968675 �[1;31mERROR�[m KafkaProducerClient:168 - Failed to send messages: ProducerRecord(topic=my-topic-1457945756-1132137355-continuous, partition=null, headers=RecordHeaders(headers = [], isReadOnly = true), key=null, value=Hello-world - 9, timestamp=null) due to: 
Cannot add partition my-topic-1457945756-1132137355-continuous-1 to transaction while in state  READY

That's because we are also wrongly configuring the beginning of the transactions.

Instead of this, we should re-write the producer code to commit every transaction properly (after each message).

To workaround this issue, the only thing that needs to be done is to set MESSAGES_PER_TRANSACTION to 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant