Preserving MessageProperties with Smooks splitter?
burmanm Jul 28, 2010 8:14 AMHi,
How to preserve some Message Properties and Headers, when using Smooks splitter? I'm interested in the gateway, where the information comes from.
As of now, I'm enriching the process with a filter in the gateway to store the original busId for later on processing. With this information, I can later on find out what sort of messages where received, so I can dynamically create XsltActions to process from different formats. This all works just fine, however when I put a Smooks splitter infront of it, I lose all that information.
Filter:
ConfigTree config = (ConfigTree) params.get(Environment.GATEWAY_CONFIG);
String value = config.getAttribute(ListenerTagNames.BUSIDREF_ATTRIBUTE_TAG);
msg.getProperties().setProperty(HeraclesMessageProperties.INPUT_GATEWAY_BUSIDREF , value);
This works fine.
Smooks splitter config:
<frag:serialize fragment="Invoice" bindTo="invoiceFrag" omitXMLDeclaration="false" />
<esbr:routeBean beanIdRef="invoiceFrag" toServiceCategory="Transformation" toServiceName="TransformationRouting" routeOnElement="Invoice" />
In the TransformationRouting service, I don't have the information anymore.
<fs-listener busidref="InHouse1InputFileChannel"
is-gateway="true" name="InHouse1FileGateway" schedule-frequency="5">
<property name="composer-class"
value="org.jboss.soa.esb.smooks.splitting.FileStreamSplitter" />
<property name="splitterConfig" value="/META-INF/smooks-splitter.xml" />
</fs-listener>
So this will fail in my Action later on in the transformation process:
String inputBusId = (String) message.getProperties().getProperty(HeraclesMessageProperties.INPUT_GATEWAY_BUSIDREF);
String inputFormat = inputChannelToFormat.get(inputBusId);
Is there a way to do splitting while still keeping the original messageProperties intact (aka copy them to the new messages) ? One way I could think of is running a service which will do just splitting and routing them to JMS queue, where I would recreate the gateway and message and keep my information. This doesn't sound like a good way of doing it, since then splitting wouldn't be part of the message's flow in the ESB. Bad for auditing purposes.
Hints?