You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Chris Egerton (Jira)" <ji...@apache.org> on 2023/06/26 10:35:00 UTC

[jira] [Assigned] (KAFKA-14972) Make KafkaConsumer usable in async runtimes

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

Chris Egerton reassigned KAFKA-14972:
-------------------------------------

    Assignee: Erik van Oosten

> Make KafkaConsumer usable in async runtimes
> -------------------------------------------
>
>                 Key: KAFKA-14972
>                 URL: https://issues.apache.org/jira/browse/KAFKA-14972
>             Project: Kafka
>          Issue Type: Wish
>          Components: consumer
>            Reporter: Erik van Oosten
>            Assignee: Erik van Oosten
>            Priority: Major
>
> KafkaConsumer contains a check that rejects nested invocations from different threads (method {{{}acquire{}}}). For users that use an async runtime, this is an almost impossible requirement. Examples of async runtimes that are affected are Kotlin co-routines (see KAFKA-7143) and Zio.
> We propose to replace the thread-id check with an access-id that is stored on a thread-local variable. Existing programs will not be affected. Developers that work in an async runtime can pick up the access-id and set it on the thread-local variable in a thread of their choosing.
> Every time a callback is invoked a new access-id is generated. When the callback completes, the previous access-id is restored.
> This proposal does not make it impossible to use the client incorrectly. However, we think it strikes a good balance between making correct usage from an async runtime possible while making incorrect usage difficult.
> Alternatives considered:
>  # Configuration that switches off the check completely.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)