You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Ray Chiang (JIRA)" <ji...@apache.org> on 2018/07/19 20:29:00 UTC

[jira] [Updated] (KAFKA-6278) Allow multiple concurrent transactions on a single producer

     [ https://issues.apache.org/jira/browse/KAFKA-6278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ray Chiang updated KAFKA-6278:
------------------------------
    Issue Type: New Feature  (was: Improvement)

> Allow multiple concurrent transactions on a single producer
> -----------------------------------------------------------
>
>                 Key: KAFKA-6278
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6278
>             Project: Kafka
>          Issue Type: New Feature
>          Components: producer 
>            Reporter: Tim Cuthbertson
>            Priority: Major
>
> It's recommended to share a producer between threads, because it's likely faster / cheaper.
> However with the transactional API there's a big caveat. If you're using transactions, every message sent to a given producer instance will be considered part of the "active transaction" regardless of what thread it came from. Furthermore, if two threads want to use transactions on a shared producer instance, it (probably) won't work.
> Possible fix: add an API which exposes the transaction ID to the user, instead of making it internal state of the producer. e.g.:
> {noformat}
> Transaction tx = producer.beginTransaction()
> producer.send(tx, message)
> producer.commitTransaction(tx)
> {noformat}
> That way, it's explicit which transaction a message will be part of, rather than the current state which is "the open transaction, which may have been opened by an unrelated thread".
> See also initial discussion on slack: https://confluentcommunity.slack.com/archives/C488525JT/p1511739734000012



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)