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

Add support for kafka transactions #222

Closed
Yexo opened this issue Jun 9, 2020 · 7 comments
Closed

Add support for kafka transactions #222

Yexo opened this issue Jun 9, 2020 · 7 comments
Milestone

Comments

@Yexo
Copy link

Yexo commented Jun 9, 2020

Is your feature request related to a problem? Please describe

I'd like to publish multiple message to Kafka in a single transaction. This makes it much easier to synchronise that action with writing multiple entries to a database and mitigates the problem of some messages being send but others failing.

Describe the solution

Add support for kafka transactions. See https://cwiki.apache.org/confluence/display/KAFKA/Transactional+Messaging+in+Kafka for details.

@mantzas
Copy link

mantzas commented Jun 9, 2020

@Yexo Hey, AFAIK sarama does not support Transactions. Has this changed?

@Yexo
Copy link
Author

Yexo commented Jun 9, 2020

I'm not sure, it definitely isn't very well documented: IBM/sarama#1299

At the same time some documentation does hint to it being supported: "TxnOffsetCommit sends a request to commit transaction offsets and returns a response or error".

@mantzas
Copy link

mantzas commented Jun 9, 2020

@Yexo we have probably to take a deeper look into the support in sarama to determine if it is supported but AFAIK it is not...
There is a function in the producer that allows sending multiple messages but I do not believe it is transactional...

      // SendMessages produces a given set of messages, and returns only when all
	// messages in the set have either succeeded or failed. Note that messages
	// can succeed and fail individually; if some succeed and some fail,
	// SendMessages will return an error.
	SendMessages(msgs []*ProducerMessage) error

@Yexo
Copy link
Author

Yexo commented Jun 9, 2020

I noticed that function too, but "Note that messages can succeed and fail individually" lead me to believe they're not send in a transaction.

@mantzas
Copy link

mantzas commented Jun 9, 2020

I agree.
Even if we cannot to transactions due to sarama limitation we can always send the same message multiple times assuming that the consumers are idempotent (and they should be if you ask me).
If the topic is log compacted it will also work since the last message is the surviving one (eventually).
There was also the notion of de-duplication on the producer side but I am not sure about this topic...

@mantzas
Copy link

mantzas commented Aug 18, 2020

@Yexo hey, i was wondering about this issue. Sice we cannot support transactions with sarama should we close this one?

@tpaschalis tpaschalis added this to the Unplanned milestone Oct 20, 2020
@mantzas
Copy link

mantzas commented Dec 24, 2020

Due to inactivity we are closing this for now.

@mantzas mantzas closed this as completed Dec 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants