In SwitchYard 0.5, a new and convenient way to map variables into and out of your jBPM processes has been introduced. The same goes for mapping variables into Drools globals. This is done by leveraging the MVEL expression language. Via XML or Java annotations, you can easily navigate your SwitchYard Exchange, Context or Message objects and pull out the data you want to set into your process or rules.
Here's a quick example using XML (you can also use the @Mapping annotation):
<implementation.bpm>
<parameters>
<mapping expression="context['org.switchyard.messageId']" variable="messageId"/>
</parameters>
<results>
<mapping expression="message.content" variable="payload"/>
</results>
</implementation.bpm>
And here's one using annotations (you can also use the <mapping/> element):
@Rules(globals={
@Mapping(expression="exchange.serviceName.localPart", variable="service")
})
To learn more and see more complete examples, please refer to the Mapping Parameter/Result Variables section of the BPM Services documentation, as well as the Mapping Global Variables section of the Rules Services documentation.
Enjoy!
Comments