Red Hat Bugzilla – Bug 975396
Drools channels are limited to statefull sessions only
Last modified: 2014-06-16 19:53:48 EDT
There is a limitation in KnowledgeBaseSessionFactory that channels are registered only if statefull session is used. They are not available for stateless sessions.
I've not found any technical reason why it should not be done for stateless sessions as well as it is natural way how to invoke (one-way) a SY service from Drools rule.
Was not it confused with entry points?
The technical reason is that the KIE/Drools/jBPM API does not provide a method to register Channels on stateless knowledge sessions - only stateful. Thus, if your action is type EXECUTE (the default), stateless is used, and Channels can't be registered. However, if you choose a different action type (FIRE_ALL_RULES, INSERT, FIRE_UNTIL_HALT), then a stateful session is used, and channels will get registered.
According to BRMS team - channels can be used for stateless sessions too.
They are not configured directly via interface calls but via sending commands CommandExecutor.execute(). Internally stateless session is only wrapper around a stateful one.
Thanks to Tomas Schlosser for the information.
"Internally stateless session is only wrapper around a stateful one."
I know that. However, every time you issue a Command to a stateless session, a new working memory (and thus new wrapped stateful session) is created. So I don't think issuing a command to register a Channel, followed by an execute (or a follow-up execute command) is going to work.
The REAL question here is "why did the drools team not expose registration of Channels on stateless sessions"? If we want to support that in SwitchYard, then I suggest we push for it's direct support from the drools team.
It works using batch execution command:
KieCommands cmdFac = KieServices.Factory.get().getCommands();
List<Command<?>> commands = new LinkedList<Command<?>>();
commands.add(new RegisterChannelCommand("channel-name", new ChannelImplementation()));
// add whatever commands are needed e.g.
Edson, could you, please, explain why the channels can't be registered on stateless session directly (the way global variables are)?
It looks like an API oversight, but I have to check in more detail. We are in the middle of beta4 release. I can try to fix this for CR1. Is that ok?
Can I assign this ticket to myself, or should we clone it into BRMS?
I exposed the channel related methods in the stateless session interface. This will be in the Drools v6.0.0.Beta5 community version. Also available in the master branch for now.
Sorry; I'm new to BZ. Is there documentation for the process somewhere? I was never taught about the "devel_ack" flag. I thought just associating the JIRA was all I had to do, and what needed to happen after that would happen automagically...
Sorry. My mistake. Flag set.
David Ward <firstname.lastname@example.org> updated the status of jira SWITCHYARD-1576 to Resolved
David Ward <email@example.com> made a comment on jira SWITCHYARD-1576
Fixed as part of SWITCHYARD-1623.
Verified in ER2
Keith Babo <firstname.lastname@example.org> updated the status of jira SWITCHYARD-1576 to Closed