我正在使用:
azure服务总线spring集成2.6.0
java 11
azure spring云流主题活页夹2.6.0
azure spring integration会自动将“azure\u服务\u总线\u时间\u到\u live”标头添加到消息中。标头的类型是java.util.duration。当消息被发送/存储到azure服务总线主题时,duration对象被转换为类似“pt336h”的字符串表示形式。这是有道理的。
在检索此消息时,azure service bus spring integration无法将字符串表示形式转换回duration对象。抛出一个错误。有人知道解决这个问题的方法吗?
非常感谢。
stacktrace:2021-07-09 09:58:40.904错误32966---[oundedelastic-2]o.s.integration.handler.logginghandler:org.springframework.messaging.messagehandlingexception:消息处理程序[com.azure.spring.integration.core]中发生错误。defaultmessagehandler@248a3912]; 嵌套异常为java.lang.classcastexception:类java.lang.string不能强制转换为类java.time.duration(java.lang.string和java.time.duration位于加载程序“bootstrap”的模块java.base中),failedmessage=genericmessage[payload=byte[997],Header={azure_service_bus_time_to_live=pt336h,原始_id=1dd5d9fd-00f0-a662-1b64-9576c66ed753,azure_checkpointer=com.azure.spring.integration.core。azurecheckpointer@5299eb8a,azure_服务_总线_已接收_消息_上下文=com.azure.messaging.servicebus。servicebusreceivedmessagecontext@3f71038e,azure_服务_总线_消息_id=1dd5d9fd-00f0-a662-1b64-9576c66ed753,id=54a5a704-4b6e-061f-37a2-7692a106e0b6,contenttype=application/json,azure_服务_总线_分区_密钥=763290660,目标协议=kafka,timestamp=1625839066772}]位于org.springframework.integration.support.utils.integrationutils.wrapinHandlingExceptionIfEssential(integrationutils.java:192),位于org.springframework.integration.handler.abstractmessagehandler.handlemessage(abstractmessagehandler.java:65)org.springframework.cloud.stream.binder.abstractmessagechannelbinder$sendinghandler.handlemessageinternal(abstractmessagechannelbinder.java:1041)位于org.springframework.integration.handler.abstractmessagehandler.handlemessage(abstractmessagehandler.java:56)位于org.springframework.integration.dispatcher.abstractdispatcher.tryoptimizeddispatch(abstractdispatcher.java:115)位于org.springframework.integration.dispatcher.org.springframework.integration.dispatcher.unicastingdispatcher.dispatcher(unicastingdispatcher.java:106)位于org.springframework.integration.channel.abstractsubscribablechannel.dosend(abstractsubscribablechannel.java:72)在org.springframework.integration.channel.abstractmessagechannel.send(abstractmessagechannel.java:317)在org.springframework.integration.channel.abstractmessagechannel.send(abstractmessagechannel.java:272)在org.springframework.messaging.core.genericmessagingtemplate.dosend(genericmessagingtemplate.java:187)在org.springframework.messaging.core.genericmessagingtemplate.dosend(genericmessagingtemplate.java:166)在org.springframework.messaging.core.genericmessagingtemplate.dosend(genericmessagingtemplate.java:47)在org.springframework.messaging.core.abstractdestinationresolvingmessagingtemplate.send(abstractdestinationresolvingmessagingtemplate.java:72)位于org.springframework.cloud.stream.function.functionconfiguration$functiontodestinationbinder$1.dosendmessage(functionconfiguration.java:589)位于org.springframework.cloud.stream.function.functionconfiguration$functiontodestinationbinder$1.handlemessageinternal(functionconfiguration.java:575)位于org.springframework.integration.handler.abstractmessagehandler.handlemessage(abstractmessagehandler.java:56)位于org.springframework.integration.dispatcher.abstractdispatcher.tryoptimizeddispatch(abstractdispatcher.java:115)位于org.springframework.integration.dispatcher.org.springframework.integration.dispatcher.unicastingdispatcher.dispatcher(unicastingdispatcher.java:106)位于org.springframework.integration.channel.abstractsubscribablechannel.dosend(abstractsubscribablechannel.java:72)在org.springframework.integration.channel.abstractmessagechannel.send(abstractmessagechannel.java:317)在org.springframework.integration.channel.abstractmessagechannel.send(abstractmessagechannel.java:272)在org.springframework.messaging.core.genericmessagingtemplate.dosend(genericmessagingtemplate.java:187)在org.springframework.messaging.core.genericmessagingtemplate.dosend(genericmessagingtemplate.java:166)在org.springframework.messaging.core.genericmessagingtemplate.dosend(genericmessagingtemplate.java:47)在org.springframework.messaging.core.abstractmessagesendingtemplate.send(abstractmessagesendingtemplate.java:109)位于org.springframework.integration.endpoint.messageproducersupport.sendmessage(messageproducersupport.java:208)位于com.azure.spring.integration.core.abstractinboundchanneladapter.receivemessage(abstractinboundchanneladapter.java:61)位于com.azure.messaging.servicebus.servicebusprocessor.lambda$processmessage$4(defaultservicebusmessageprocessor.java:70)位于com.azure.messaging.servicebus.servicebusprocessorclient$1.onnext(servicebusprocessorclient.java:226)位于com.azure.messaging.servicebus.servicebusprocessorclient$1.onnext(servicebusprocessorclient.java:200)位于reactor.core.publisher.fluxpublishon$publishonsubscriber.runasync(fluxpublishon.java:440)位于reactor.core.publisher.fluxpublishon$PublishSubscriber.run(fluxpublishon.java:527)位于reactor.core.scheduler.workertask.call(workertask.java:84)位于java.base/java.util.concurrent.futuretask.run$$$$capture(futuretask.java:264)java.base/java.util.concurrent.futuretask.run(futuretask.java)java.base/java.util.concurrent.scheduledthreadpoolexecutor$scheduledfuturetask.run(scheduledthreadpoolexecutor.java:304)atjava.base/java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1128)位于java.base/java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:628)位于java.base/java.lang.thread.run(thread.java:829)处,原因是:java.lang.classcastexception:类java.lang.string不能转换为类java.time.duration(java.lang.string和java.time.duration位于加载程序“bootstrap”的模块java.base中),位于com.azure.spring.integration.servicebus.converter.servicebusmessageconverter.setcustomheaders(servicebusmessageconverter.java:91)com.azure.spring.integration.servicebus.converter.servicebusmessageconverter.setcustomheaders(servicebusmessageconverter.java:39)位于com.azure.spring.integration.core.converter.abstractazuremessageconverter.frommessage(abstractazuremessageconverter.java:72)位于com.azure.spring.integration.servicebus.servicebustemplate.sendaync(servicebustemplate.java:57)位于com.azure.spring.integration.core.defaultmessagehandler.handlemessageinternal(defaultmessagehandler.java:74)位于org.springframework.integration.handler.abstractmessagehandler.HandleMessageMessage(abstractmessagehandler.java:56)。。。40多
暂无答案!
目前还没有任何答案,快来回答吧!