Skip to content

Use blocking poll and task executor preferences #165

@blindspotbounty

Description

@blindspotbounty

We are currently using the non-blocking poll call to rdkafka and if there are no messages we sleep. This works but it means there is a potential delay.

Instead, we could do a non-blocking poll and if there are no results we can switch to using task executor preference to switch to a DispatchQueue backed executor and call the blocking poll method. That way we get notified as soon as a new message is available.

Roughly speaking this could look something like this

 if let message = try client.consumerPoll() { // non-blocking call
   return message
}

await withTaskExecutorPreference(someQueue) {
    try client.consumerBlockingPoll()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions