...
The received exchange is added as a fact to the working memory.
Note that, due to Drools limited support for non simple java beans accessors, the JBI MessageExchange and NormalizedMessage are wrapped with simple beans.
Injecting additional beans in the rules
The JbiHelper is injected by the component itself so that you can access the current exchange and handle it. However, there are cases where you need to add your own beans and inject them in the rules definition. Starting from ServiceMix 3.2, this is now possible using the following syntax:
Code Block | ||
---|---|---|
| ||
<drools:endpoint service="test:service"
endpoint="endpoint"
ruleBaseResource="classpath:router.drl"
globals="#globals" />
<util:map id="globals">
<entry key="helper" value-ref="helper" />
</util:map>
<bean id="helper" class="org.example.Helper" />
|
In the rules definition, just add:
Code Block |
---|
global org.example.Helper helper;
|
Then you can use it from your rules ...
Router
Code Block | ||||
---|---|---|---|---|
| ||||
<drools:endpoint service="test:service" endpoint="endpoint" ruleBaseResource="classpath:router.drl" /> |
...