one option might be to create a custom message composers for the gateways.
They could all place the data in the same location and make sure that it is of the the correct type. This way no extra checking would be needed in the service then.
The composer class to be used in specified in the on the gateway listener like this:
<fs-listener name="FileGateway" busidref="fsRef" is-gateway="true" poll-frequency-seconds="2"> <property name="composer-class" value="yourClass"/> </fs-listener>
You can look at the org.jboss.soa.esb.listeners.message.MessageComposer interface which you will need to implement.
Would that be an option for you do you think?
I had a look and saw that it gives complete control over "what" the entire message is. I think I'll extend the Message class and create something like "MyMessage" that can cover anything that comes up in the future as well.
Although these are my first steps with JBossESB, this feels much more elegant and versatile to me. Thanks for pointing me there.