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

New receiver source: Flux<Flux<ReceiverRecord<K, V>>> #118

Open
justinplus opened this issue Nov 29, 2019 · 1 comment
Open

New receiver source: Flux<Flux<ReceiverRecord<K, V>>> #118

justinplus opened this issue Nov 29, 2019 · 1 comment

Comments

@justinplus
Copy link

It would be nice if reactor-kafka receiver adds a new API:

Flux<Flux<ReceiverRecord<K, V>>> receiveMannualAck() 

Normally, to achieve high throughput, there would be multiple parallel processors in a Kafka consumer.

In this case, existing Flux<ReceiverRecord<K, V>> receive() is hard for multiple parallel processors to manage the offsets. And another API, Flux<Flux<ConsumerRecord<K, V>>> receiveAutoAck() which auto ack when the inner Flux is terminated, is hard to used to design and implement some smart commit strategies especially in multiple topic-partition subscription scenario.

@turbospaces
Copy link

I agree with @justinplus and also looking for something like this:

@Override
    public Flux<Flux<ReceiverRecord<K, V>>> receiveManualAck() {
        this.ackMode = AckMode.MANUAL_ACK;
        Flux<ConsumerRecords<K, V>> flux = withDoOnRequest(createConsumerFlux());
        return flux.map(consumerRecords -> Flux.fromIterable(consumerRecords).map( r -> {
            TopicPartition topicPartition = new TopicPartition(r.topic(), r.partition());
            CommittableOffset committableOffset = new CommittableOffset(topicPartition, r.offset());
            return new ReceiverRecord<>(r, committableOffset);
        } ));
    }

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

2 participants