私たちのアプリケーションではSpring Integrationを使用しました。最近、プロジェクトをspring boot 1.4 release
にアップグレードしようとしました。spring java dsl 1.1.3
を使用しています。最新のリリースでは、messageDriverChannelAdapter
が非推奨になり、名前はmessageDriverChannelAdapter
という新しいメソッドが作成されました。つまり、「r」が固定されています。1.1.3にアップグレードした後、エラーチャネルにエラーメッセージが配信されないspring integration java dsl
Java dsl 1.1.1のmessageDriverChannelAdapter
を使用すると、統合フローは正常に動作しますが、失敗のケースでは1.1.3で失敗します(つまり、フローで例外が発生します)。ここで
IntegrationFlows
.from(Jms.messageDriverChannelAdapter(listenerContainer()).errorChannel(errorChannel())
.outputChannel(listenerDirectChannel()))
.channel(listenerDirectChannel()).transform(new JsonToChangeObjectTransformer())
.channel(conversionOutChannel()).handle(CHANGED_OBJECT_LISTENER_IMPL, PROCESS_MESSAGE)
.channel(errorChannel()).handle(FAILED_MESSAGE_HANDLER_IMPL, HANDLE_ERROR).get();
私も試してみました
IntegrationFlows
.from(Jms.messageDrivenChannelAdapter(listenerContainer())
.errorChannel(errorChannel())
.outputChannel(listenerDirectChannel()))
.channel(listenerDirectChannel())
.transform(new JsonToChangeObjectTransformer())
.<Object, Boolean> route(p -> p instanceof ChangedObject,
m -> m.channelMapping("true", "conversionOutChannel").channelMapping("false", "errorChannel"))
.channel(conversionOutChannel())
.handle(CHANGED_OBJECT_LISTENER_IMPL, PROCESS_MESSAGE).channel(errorChannel())
.handle(FAILED_MESSAGE_HANDLER_IMPL, HANDLE_ERROR).get();
が、それでも運です
私の観察はメッセージチャネルをエラーに配信されることはありません(私がデバッグしているとして)最終的に起こるチャネルにメッセージを配置しようとし続ける。stackoverflowerror
例外:
org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:212)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:129)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:115)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:160)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:121)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:292)
at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:212)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:129)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:115)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:160)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:121)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)