Exception when using StreamBridge to send partition message with nativeEncoding
See original GitHub issueDescribe the issue When using StreamBridge to send a partitioned message with nativeEncoding, StreamBridge will throw a type cast exception.
To Reproduce Steps to reproduce the behavior:
- useNativeEncoding set to true
- Send Message with partition header
Version of the framework 3.0.10.RELEASE
Expected behavior Message is sent correctly
Screenshots
java.lang.ClassCastException: org.springframework.cloud.stream.function.StreamBridge$$Lambda$1350/1117349678 cannot be cast to org.springframework.cloud.function.context.catalog.SimpleFunctionRegistry$FunctionInvocationWrapper
at org.springframework.cloud.stream.function.StreamBridge.send(StreamBridge.java:153)
at org.springframework.cloud.stream.function.StreamBridge.send(StreamBridge.java:124)
Additional context I take a look at the code of StreamBridge and this issue was caused by this line
Function<Object, Object> functionToInvoke = skipConversion
? v -> v instanceof Message ? v : MessageBuilder.withPayload(v).build()
: this.functionCatalog.lookup(STREAM_BRIDGE_FUNC_NAME, outputContentType.toString());
if (producerProperties != null && producerProperties.isPartitioned()) {
functionToInvoke = new PartitionAwareFunctionWrapper((FunctionInvocationWrapper) functionToInvoke, this.applicationContext, producerProperties);
}
So in the case of skipConversion and partitioned message, a Function object will be cast to FunctionInvocationWrapper
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Spring Cloud Stream - StreamBridge error on send
setHeader(PARTITION_KEY, messageId) .build(); ... When streamBridge.send is invoked I get this error: java.lang.ClassCastException: class ...
Read more >Preface - Spring
Doing so prevents the application's instances from receiving duplicate messages (unless that behavior is desired, which is unusual). Partitioning Support.
Read more >Introduction to Spring Cloud Stream - Baeldung
Learn how to create message-driven and event-driven microservices using Spring Cloud Stream and RabbitMQ.
Read more >spring-cloud/spring-cloud-stream - Gitter
messages are expired from DLQ but not being routed back to original ... With the RabbitMQ binder you can't consume from multiple partitions...
Read more >Part 2: Apache Kafka and Spring Cloud Stream - Confluent
How is the message coming from the Kafka topic converted to this POJO? ... Stream provides options for sending data to specific partitions....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@bonndan Sorry about the delay. The next Spring Cloud release which will pick up 3.1.4 of stream is set for September 21. I just updated the Milestone
We are desperate and now trying to workaround this issue using jitpack.io. However, a different solution would be very appreciated. Is a release in sight?