Reputation: 114
I would like to send message through
'startChannel->router1->outChannel'
If I comment out 'config-2.xml' content, it work as I expect.
When I enable 'config-2.xml' content, I expect it should send message through
'startChannel->router1->routerChannel->router2->outChannel'
but I get following exception.
EL1008E:(pos 0): Property or field 'routerChannel' cannot be found on object of type 'org.springframework.integration.message.GenericMessage' - maybe not public?
How do I route message to 'routerChannel'?
config-1.xml
<int:channel id="startChannel"/>
<int:router id="router1"
input-channel="startChannel"
default-output-channel="outChannel"
resolution-required="false"
expression="routerChannel"/>
<int:channel id="outChannel"/>
config-2.xml
<int:channel id="routerChannel"/>
<int:router id="router2"
input-channel="routerChannel"
resolution-required="true"
expression="payload.paymentType">
<int:mapping value="CASH" channel="cashPaymentChannel"/>
<int:mapping value="CREDIT" channel="authorizePaymentChannel"/>
<int:mapping value="DEBIT" channel="authorizePaymentChannel"/>
</int:router>
Upvotes: 0
Views: 176
Reputation: 139
The expression in the router will be evaluated and the result should be string (single channel) or collection of string (multiple channel). In your use case router expression doesn't make sense in config1.xml. If it is direct channel value, there is no use of router here.
Upvotes: 1
Reputation: 121542
Your SpEL must be like this:
expression="@routerChannel"/>
Since it is runtime expression we have to honor its bean reference protocol.
Upvotes: 1