How to convert Spring Integration XML to Java DSL for errorChannel -
i have below xml configuration in application , convert java dsl.
so in reference i'm explicitly defining name error channel. example reason. reference i'm expecting happen when downstream process throws , exception should route payload through error channel. java code like?
<int-jms:message-driven-channel-adapter id="notification" connection-factory="connectionfactory" destination="otificationqueue" channel="notificationchannel" error-channel="error" /> <int:chain id="chainerror" input-channel="error"> <int:transformer id="transformererror" ref="errortransformer" /> <int-jms:outbound-channel-adapter id="error" connection-factory="connectionfactory" destination="errorqueue" /> </int:chain>
@bean public integrationflow jmsmessagedrivenflow() { return integrationflows .from(jms.messagedriverchanneladapter(this.jmsconnectionfactory) .id("notification") .destination(this.notificationqueue) .errorchannel(this.errorchannel)) ... .get(); } @bean public integrationflow errorflow() { return integrationflows .from(this.errorchannel) .transform(errortransformer()) .handle(jms.outboundadapter(this.jmsconnectionfactory) .destination(this.errorqueue), e -> e.id("error")) .get(); }
edit:
@bean public messagechannel errorchannel() { return new directchannel(); }
and autowire it, or reference as
.errorchannel(errorchannel())
Comments
Post a Comment