-
Notifications
You must be signed in to change notification settings - Fork 1.6k
The addition of a parameter of type ConsumerRecordMetaData
breaks a working setup
#2295
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
Milestone
Comments
Strange behavior indeed; thanks for the reproducer. |
garyrussell
added a commit
to garyrussell/spring-kafka
that referenced
this issue
Jun 6, 2022
Resolves spring-projects#2295 A subclass of `InvocableHandlerMethod` was used to signal that a method needs a `ConsumerRecordMetadata` to be constructed. However, the constructor that takes an existing IHM, does not fully clone the argument passed into it. Then, the payload resolver was not invoked to resolve that parameter. Use a map of booleans instead, to signal the creation of the metadata. **cherry-pick to 2.9.x, 2.8.x, 2.7.x**
garyrussell
added a commit
to garyrussell/spring-kafka
that referenced
this issue
Jun 6, 2022
Resolves spring-projects#2295 A subclass of `InvocableHandlerMethod` was used to signal that a method needs a `ConsumerRecordMetadata` to be constructed. However, the constructor that takes an existing IHM, does not fully clone the argument passed into it. Then, the payload resolver was not invoked to resolve that parameter. Use a map of booleans instead, to signal the creation of the metadata. **cherry-pick to 2.9.x, 2.8.x, 2.7.x**
artembilan
pushed a commit
that referenced
this issue
Jun 6, 2022
Resolves #2295 A subclass of `InvocableHandlerMethod` was used to signal that a method needs a `ConsumerRecordMetadata` to be constructed. However, the constructor that takes an existing IHM, does not fully clone the argument passed into it. Then, the payload resolver was not invoked to resolve that parameter. Use a map of booleans instead, to signal the creation of the metadata. **cherry-pick to 2.9.x, 2.8.x, 2.7.x**
artembilan
pushed a commit
that referenced
this issue
Jun 6, 2022
Resolves #2295 A subclass of `InvocableHandlerMethod` was used to signal that a method needs a `ConsumerRecordMetadata` to be constructed. However, the constructor that takes an existing IHM, does not fully clone the argument passed into it. Then, the payload resolver was not invoked to resolve that parameter. Use a map of booleans instead, to signal the creation of the metadata. **cherry-pick to 2.9.x, 2.8.x, 2.7.x**
artembilan
pushed a commit
that referenced
this issue
Jun 6, 2022
Resolves #2295 A subclass of `InvocableHandlerMethod` was used to signal that a method needs a `ConsumerRecordMetadata` to be constructed. However, the constructor that takes an existing IHM, does not fully clone the argument passed into it. Then, the payload resolver was not invoked to resolve that parameter. Use a map of booleans instead, to signal the creation of the metadata. **cherry-pick to 2.9.x, 2.8.x, 2.7.x**
artembilan
pushed a commit
that referenced
this issue
Jun 6, 2022
Resolves #2295 A subclass of `InvocableHandlerMethod` was used to signal that a method needs a `ConsumerRecordMetadata` to be constructed. However, the constructor that takes an existing IHM, does not fully clone the argument passed into it. Then, the payload resolver was not invoked to resolve that parameter. Use a map of booleans instead, to signal the creation of the metadata. **cherry-pick to 2.9.x, 2.8.x, 2.7.x**
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In what version(s) of Spring for Apache Kafka are you seeing this issue?
2.6.8
Describe the bug
I have written a consumer, that consumes multiple types of messages.
The consumer is annotated with
@KafkaListener
at class-level.The handler-methods for the known messate-types are annotated with
@KafkaHandler
.The methods only a parameter of the type of the expected message.
Everything works fine...
After adding an additional parameter of type
ConsumerRecordMetaData
, the consumer is no longer able to receive messages of any type, because no appropriate resolvers could be found.In fact, debugging shows, that not reolvers at all are configured, when the handler-method is called.
After adding a default-method, that handles an messages of unknown type, everything works as expected again.
To Reproduce
ConsumerRecordMetaData
everything works as expextedExpected behavior
If receiving of messages of multiple types works without a default-handler for messages of unknown type, the same setup should work without a default-handler.
If the handler-methods also require an additional parameter of type
ConsumerRecordMetaData
, because they require knowledge about the partition, offset or any other technical detail, this should not force the implementation of an additional handler-method for unknown messages.Sample
Example with a working setup, the broken setup, if metadata are required, and the crooked workaround
The text was updated successfully, but these errors were encountered: