Skip to content

Conversation

artembilan
Copy link
Member

Fixes: #3690

When this.listener is an instance of RecordMessagingMessageListenerAdapter, we rely on its logic to call invoke() from super class to handle observation lifecycle this or other way.
However, Spring Integration's KafkaMessageDrivenChannelAdapter use its own IntegrationRecordMessageListener extension of the RecordMessagingMessageListenerAdapter without calling super invoke().
The problem apparent from Spring Cloud Stream Kafka Binder, where an observation is enabled.

  • Fix KafkaMessageListenerContainer to check for exact type of this.listener before making decision to close an observation here, or propagate it down to the RecordMessagingMessageListenerAdapter

…enerContainer`

Fixes: spring-projects#3690

When `this.listener` is an instance of `RecordMessagingMessageListenerAdapter`,
we rely on its logic to call `invoke()` from super class to handle observation
lifecycle this or other way.
However, Spring Integration's `KafkaMessageDrivenChannelAdapter` use its own
`IntegrationRecordMessageListener` extension of the `RecordMessagingMessageListenerAdapter`
without calling super `invoke()`.
The problem apparent from Spring Cloud Stream Kafka Binder, where an observation is enabled.

* Fix `KafkaMessageListenerContainer` to check for exact type of `this.listener`
before making decision to close an observation here, or propagate it down to the `RecordMessagingMessageListenerAdapter`
@sobychacko sobychacko merged commit c9e7edc into spring-projects:main Dec 23, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

Memory leak on a Kafka Observation due to the metric "spring.kafka.listener.active"
2 participants