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

Feature: add Kafka transactions support #1157

Open
ManiMozaffar opened this issue Jan 21, 2024 · 7 comments
Open

Feature: add Kafka transactions support #1157

ManiMozaffar opened this issue Jan 21, 2024 · 7 comments
Labels
AioKafka Issues related to `faststream.kafka` module Confluent Issues related to `faststream.confluent` module enhancement New feature or request Kafka Issues related to Kafka functionality (confluent and aiokafka both)

Comments

@ManiMozaffar
Copy link

Is your feature request related to a problem? Please describe.
In batch processing, a group of messages is processed together. Transactions ensure that this entire batch is treated as a single unit of work. Although library support adding it to the producer config, but it doesn't support actualy using it.

Describe the solution you'd like
Some document and reworks regarding low level access to producer and consumer would be really nice in general. I think going forward this would be needed.

@ManiMozaffar ManiMozaffar added the enhancement New feature or request label Jan 21, 2024
@Lancetnik
Copy link
Member

@ManiMozaffar which broker are you talking?

@ManiMozaffar
Copy link
Author

Kafka

@ManiMozaffar
Copy link
Author

@Lancetnik either all messages should be produced, or none.

@davorrunje
Copy link
Collaborator

@ManiMozaffar we'll release a new Kafka broker based on Confluent lib this week. This is a good time to let us know what features you would like us to support.

@ManiMozaffar
Copy link
Author

@davorrunje I haven't had a chance yet to deep dive into code, but on documentation would be really nice to give some idea about low level access to broker and other stuff, I think that would be nessecary because of many things like instrumenting the broker, fixing weird bugs sometimes happening with brokers. E.x if broker dies and it was on transaction, it would go to a state where it can't produce a message transactionality so you'd have to restart the broker. (it loses the state of producer mapping to transactional id, or aka INVALID_PRODUCER_ID_MAPPING)

@Lancetnik Lancetnik added Confluent Issues related to `faststream.confluent` module AioKafka Issues related to `faststream.kafka` module Kafka Issues related to Kafka functionality (confluent and aiokafka both) labels May 16, 2024
@Lancetnik Lancetnik changed the title Feature: Batch processing really need good transaction support Feature: add Kafka transactions support May 16, 2024
@Lancetnik Lancetnik moved this to Backlog in FastStream May 16, 2024
@Lancetnik Lancetnik mentioned this issue Jun 9, 2024
63 tasks
@RubenRibGarcia
Copy link
Contributor

Hello once again! @Lancetnik I was reading a bit about the story for this feature ( specially a closed PR #1290 ) and I would like to talk a little bit about it's approach. That is, I know there is another feature on the Roadmap for RMQ to also support publish transaction and I think it would be best that both approaches followed a same pattern.

Focusing on Kafka... does it make sense that for KafkaBroker (both AioKafka and Confluent) have the publish decorator with a transaction argument ? The idea behind this is to abstract the way to handle transactions on both libs, but I'm also thinking that we should also provide some sort of annotation for developer to have more control over the transaction using explicit "begin", "commit", "rolback" methods.

@Lancetnik
Copy link
Member

@RubenRibGarcia It is a much complex feature we image before and I am even not sure, that we can support it in FastStream API (in Kafka case at least)

The main idea now - is Depends-based transactional for RMQ (and Kafka probably)

@broker.subscriber(...)
async def handler(
    msg,
    transaction: Transaction  # will be commited after handler reseived
): ...

Anyway, we will back to this discussion little bit further

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AioKafka Issues related to `faststream.kafka` module Confluent Issues related to `faststream.confluent` module enhancement New feature or request Kafka Issues related to Kafka functionality (confluent and aiokafka both)
Projects
Status: Backlog
Development

No branches or pull requests

4 participants