-
Notifications
You must be signed in to change notification settings - Fork 1.1k
GH-3661: Resolve Spring Apache Kafka Deprecations #3751
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the doc fix.
Amazing!
Don't we need to mention anything in the "What's New" ?
import org.springframework.retry.support.RetryTemplate; | ||
|
||
/** | ||
* @author Gary Russell |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any general JavaDoc, please?
containerProperties.setMessageListener(kafkaListener); | ||
Object existing = containerProperties.getMessageListener(); | ||
if (existing != null) { | ||
logger.warn(() -> "Container's existing message listener (" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we throw an IllegalArgumentException
instead to signal that provided listener is wrong?
I just try to avoid questions why their listener is out of use...
doWithRetry(template, KafkaInboundGateway.this.recoveryCallback, record, acknowledgment, consumer, | ||
() -> { | ||
Message<?> toSend = enhanceHeaders(message, record, acknowledgment, consumer); | ||
if (toSend != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need to do anything in the else
? Like exception or though...
Might be some questions like "where is my message?!"
This might be an existing logic though, therefore I won't mind if we revise it in the separate issue/PR...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns out the try/catch in enhanceHeaders is not necessary - artifact of refactoring; will fix.
if (errorChannel != null) { | ||
KafkaInboundGateway.this.messagingTemplate.send(errorChannel, buildErrorMessage(null, | ||
new ConversionException("Failed to convert to message", record, ex))); | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However this may cover us.
Please, confirm that this is an intention for the missed else
I mention before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment above.
private void doSendAndReceive(Message<?> message) { | ||
try { | ||
Message<?> reply = sendAndReceiveMessage(message); | ||
if (reply != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we do anything over here when really no reply
?
@@ -152,7 +152,7 @@ private static void registerBean(String beanName, Object bean, BeanFactory beanF | |||
"beanFactory must be an instance of GenericApplicationContext"); | |||
GenericApplicationContext applicationContext = (GenericApplicationContext) beanFactory; | |||
|
|||
applicationContext.registerBean(beanName, (Class<Object>) bean.getClass(), () -> bean); | |||
// applicationContext.registerBean(beanName, (Class<Object>) bean.getClass(), () -> bean); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason why this is removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bogus - I am having some problem with Eclipse and this code.
Resolves #3661