Closed Sheldoras closed 1 week ago
@moarychan @netyyyy @rujche @saragluna
Thank you for your feedback. Tagging and routing to the team member best able to assist.
Hi @Sheldoras , thanks for using Service Bus binder!
I can reproducer this issue, the root cause is that the Spring Cloud Stream's sub application context does not contains the custom ObjectMapper bean, there're two workaround to fix it:
Register your custom configuration to the sub context, add below configuration:
spring:
cloud:
stream:
binders:
my_bus:
environment:
spring:
main:
sources: com.example.demo.ConsumerConfig
Share the ObjectMapper bean to sub context, add a file named src/main/resources/META-INF/shared.beans
and context is the com.fasterxml.jackson.databind.ObjectMapper
.
(Recommend) Use a BinderCustomizer bean to customize the binder, add a below code:
@Bean
BinderCustomizer binderCustomizer() {
return (binder, binderName) -> {
ServiceBusMessageChannelBinder serviceBus = (ServiceBusMessageChannelBinder) binder;
serviceBus.setMessageConverter(new ServiceBusMessageConverter(new ObjectMapper()));
};
}
Meanwhile, a PR to add shared beans is under review.
Describe the bug Azure Service Bus for Spring Cloud Stream offers the property
isolated-object-mapper
see here which, at least from what I gather from the property description and available tests regarding this property, should enable a consumer of the library to define their ownObjectMapper
to be used for the ServiceBusMessageConverter in place of a default one.Exception or Stack Trace
To Reproduce Minimal setup to reproduce Just run the application and it should fail with the error listed above.
Expected behavior My expectation would be that when I set
isolated-object-mapper
to false - denoting that I do not want the isolated default to be used - but will instead provide my own ObjectMapper as Bean - this custom ObjectMapper is actually used.Setup (please complete the following information):
Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report