Skip to content

ReplyingKafkaTemplate not properly handling reply timeout #1883

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

Closed
Jereminet opened this issue Jul 23, 2021 · 1 comment · Fixed by #1884
Closed

ReplyingKafkaTemplate not properly handling reply timeout #1883

Jereminet opened this issue Jul 23, 2021 · 1 comment · Fixed by #1884

Comments

@Jereminet
Copy link

Hi,

While browsing through the code of the ReplyingKafkaTemplate, I noticed the following:

  • According to the parent specifications of the sendAndReceive(ProducerRecord<K, V> record, Duration replyTimeout) method in ReplyingKafkaOperations, the reply timeout should be set to the default value if a null value is passed as argument. However, I don't see any check for that in the implementation and get an NullPointerException from the scheduler when passing the null value. I guess something is missing here.
  • The sendAndReceive(Message<?> message, Duration replyTimeout, @Nullable ParameterizedTypeReference<P> returnType) method takes the timeout in parameter but never uses it. I guess the first line in the implementation should be
RequestReplyFuture<K, V, R> future = sendAndReceive((ProducerRecord<K, V>) getMessageConverter()
.fromMessage(message, getDefaultTopic()), replyTimeout);

instead of

RequestReplyFuture<K, V, R> future = sendAndReceive((ProducerRecord<K, V>) getMessageConverter()
.fromMessage(message, getDefaultTopic()));

I hope these comments are valuable and I didn't misunderstand something.

Regards,

Jeremy

@garyrussell
Copy link
Contributor

Good catches; thanks.

@garyrussell garyrussell added this to the 2.8.0-M2 milestone Jul 23, 2021
garyrussell added a commit to garyrussell/spring-kafka that referenced this issue Jul 23, 2021
Resolves spring-projects#1883

NPE when `null` `replyTimeout` supplied (javadoc says it's allowed and means use default).
`replyTimeout` argument ignored on message-based methods.

**cherry-pick to 2.7.x**
artembilan pushed a commit that referenced this issue Jul 23, 2021
Resolves #1883

NPE when `null` `replyTimeout` supplied (javadoc says it's allowed and means use default).
`replyTimeout` argument ignored on message-based methods.

**cherry-pick to 2.7.x**
artembilan pushed a commit that referenced this issue Jul 23, 2021
Resolves #1883

NPE when `null` `replyTimeout` supplied (javadoc says it's allowed and means use default).
`replyTimeout` argument ignored on message-based methods.

**cherry-pick to 2.7.x**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants