Other possible solution is to create a FileMarshaller and insert into file
poller in this Marshaller you take the original Message and insert other
attribute that identify the original poller.
If you have the original Message
<mess>
<data1/>
<data2/>
<dataN/>
</mess>
you take this message and aggregate new tag with your origin
<mess>
<origin>FilePoller1</origin>
<data1/>
<data2/>
<dataN/>
</mess>
In the next steps you can request the origin ussing XPath and use this value
to take decisions into the route.
You can create the Marshaller with "origin" property and inject the value
dinamically at bean definition, in this way to create N origins you only
need to define N beans with differente "origin" value and Inject the beans
into file pollers.
<file:poller service="YourService"
endpoint="point"
targetService="TargServ"
targetEndpoint="TargPoint"
file="YourDirectory">
<bean ref="#myMarshaler" />
</property>
</file:poller>
<property name="myMarshaler">
<bean class="org.YourPackage.FileMarshalerOrigin">
<property name="origin" value="Origin1"/>
</bean>
</property>
atr wrote:
>
> Hello.
>
> I've got a problem with ServiceMix 3.2. and a message routing. Following:
>
> I receive a message with a file poller:
> Point 1:
> <file:poller service="sportscheck:OrdersInProduction"
> endpoint="endpoint"
> targetService="sportscheck:eip"
> file="${demandware.export.production.orders}"
> recursive="true"
> period="${orders.dw.export.210.filepoller}"
> filter="#XMLFilter">
> </file:poller>
>
> This message will be sent to:
> Point 2:
> <eip:static-recipient-list service="sportscheck:eip"
> endpoint="endpoint">
> <eip:recipients>
> <eip:exchange-target service="sportscheck:orderBean" />
> <eip:exchange-target service="sportscheck:archiveBean"
> />
> </eip:recipients>
> </eip:static-recipient-list>
>
> and then again to:
> Point 3:
> <bean:endpoint service="sportscheck:orderBean"
> endpoint="endpoint" bean="#OrderBean" />
> <bean id="OrderBean"
> class="de.mmsdresden.sportscheck.beans.OrderBean"
> />
> <bean id="ArchiveBean"
> class="de.mmsdresden.sportscheck.beans.ArchiveBean" />
> </beans>
>
> The java bean receives the message as object of type
> javax.jbi.messaging.MessageExchange.
> How can I identify the starting point (Point 1) of my message, what is in
> my example the file:poller ?
>
> I need any identifying information, because I use this message routing way
> (Point1 - Point2 - Point3) with several <file:pollers> (Point1a - Point1b
> - Pointxyz). In my java bean I want be able to know where my message comes
> from, which file poller (Point1a - Point1b - Pointxyz) have been used.
>
> I can I solve shuch a problem? Is there a possibility to provide a
> variable in the different file pollers or can is get the name of the
> service (in my example "sportscheck:OrdersInProduction")?
>
> Thank you really for a help!
>
> Andreas.
>
--
View this message in context:
http://www.nabble.com/How-to-identify-message-origin-after-several-routings---tp25801620p25813805.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.