Skip to content

PC 0.5.2.5 - pollAndProduce with zero message result ? #574

Closed Answered by rkolesnev
mikhelef asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @mikhelef,

Sorry - i've missed the original question - you can use pollAndProduceMany instead.
Return type for it is List - and you can return empty list when you don't want to produce a record.
As a quick example :

    parallelConsumer.pollAndProduceMany(context -> {
                    var consumerRecord = context.getSingleRecord().getConsumerRecord();
                    Optional<Result> optionalResult = processBrokerRecord(consumerRecord);
                    if(optionalResult.isEmpty()) {
                        return Collections.emptyList();
                    }else {
                        Result result = optionalResult.get();
                        return Collections.single…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@mikhelef
Comment options

Answer selected by mikhelef
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants