[jboss-dev-forums] [JBoss ESB Development] - Re: Supporting entry-point
jeffdelong
do-not-reply at jboss.com
Wed Sep 9 17:06:04 EDT 2009
BusinessRulesProcessor needs additional configuration parameters as well as code to support CEP. These include:
EventProcessingOption with values of STREAM or CLOUD
The code to use this would be something like:
|
| kconfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
| kconfig.setOption( EventProcessingOption.STREAM );
| kbase = readKnowledgeBase(kconfig);
| sconfig = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
| sconfig.setOption( ClockTypeOption.get( ClockType.REALTIME_CLOCK.getId() ) );
| ksession = kbase.newStatefulKnowledgeSession(sconfig, null);
|
|
Exit-points should also be supported. This would require configuration such as
|
| <action class="org.jboss.soa.esb.actions.BusinessRulesProcessor" name="OrderCountHistory">
| <property name="ruleSet" value="OrderCount.drl"/>
| <property name="ruleReload" value="true"/>
| <property name="stateful" value="true"/>
| <property name="object-paths">
| <object-path entry-point="OrderEntryPoint" esb="body.TheOrderHeader"/>
| </property>
| <property name="exitPoint value="OrderExitPoint"
| <route-to destination-name="x" service-category="y" service-name="z"/>
| <property name="set-payload-location" value="orderResultPayload"/>
| </property>
| </action>
|
|
The configuration of multiple exit points should be allowed. Not sure how to add the set-payload-location but something like this is needed.
A class would then need to be added that implemented the ExitPointInterface such as:
|
| public class RulesCallbackInvoker implements ExitPoint
| {
| public void insert(Object object) {
| try {
| ServiceInvoker invoker = new ServiceInvoker(service-category, service-name");
| Message requestMessage;
| requestMessage = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
| // add payload stuff
| requestMessage.getBody().add(object);
| invoker.deliverAsync(requestMessage);
| } catch (MessageDeliverException mde) {
| System.out.println("Eating this Exception: " + mde);
| }
| }
|
| }
|
|
|
Then the BRP would need to add:
|
| RulesCallbackInvoker exit = new RulesCallbackInvoker();
| KnowledgeRuntime kruntime = (KnowledgeRuntime) ksession.getEnvironment();
| kruntime.registerExitPoint("exit-point", exit);
|
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4254281#4254281
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4254281
More information about the jboss-dev-forums
mailing list