[
https://issues.apache.org/jira/browse/CAMEL-18627?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17620446#comment-17620446
]
Otavio Rodolfo Piske edited comment on CAMEL-18627 at 10/19/22 4:33 PM:
------------------------------------------------------------------------
[~geek.rupam] thanks for the report. -Can you provide the stack trace, please?-
Ok, stack trace not needed after the updated description.
Are you planning to send a PR for this one as well [~geek.rupam]? Please, feel
free to do so! We might still have time to squeeze it in 3.18.3 ...
was (Author: orpiske):
[~geek.rupam] thanks for the report. Can you provide the stack trace, please?
> camel-kafka: Kafka resume throws null pointer exception if no partition
> offset exists
> -------------------------------------------------------------------------------------
>
> Key: CAMEL-18627
> URL: https://issues.apache.org/jira/browse/CAMEL-18627
> Project: Camel
> Issue Type: Bug
> Components: camel-kafka
> Affects Versions: 3.18.3
> Reporter: rupam
> Assignee: Otavio Rodolfo Piske
> Priority: Trivial
> Fix For: 3.20.0
>
>
>
> In the updateTaskState() method, if the consumer is resumed and it had no
> previously stored offset details, then it throws a null pointer exception
> when it tries to retrieve ((OffsetAndMetadata) v).offset() information
>
> {code:java}
> private void updateTaskState() {
> switch (state) {
> case PAUSE_REQUESTED:
> LOG.info("Pausing the consumer as a response to a pause request");
> consumer.pause(consumer.assignment());
> state = State.PAUSED;
> break;
> case RESUME_REQUESTED:
> LOG.info("Resuming the consumer as a response to a resume request");
> if (consumer.committed(consumer.assignment()) != null) {
> consumer.committed(consumer.assignment()).forEach((k, v) -> {
> final TopicPartition tp = ((TopicPartition) k);
> LOG.info("Resuming from offset {} for the topic {} with
> partition {}",
> ((OffsetAndMetadata) v).offset(), tp.topic(),
> tp.partition());
> consumer.seek(tp, ((OffsetAndMetadata) v).offset());
> }
> );
> }
> consumer.resume(consumer.assignment());
> state = State.RUNNING;
> break;
> default:
> break;
> } }
> {{code}
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)