Bug 975396 - Drools channels are limited to statefull sessions only
Drools channels are limited to statefull sessions only
Product: JBoss Fuse Service Works 6
Classification: JBoss
Component: SwitchYard (Show other bugs)
6.0.0 GA
Unspecified Unspecified
unspecified Severity medium
: ER1
: ---
Assigned To: Edson Tirelli
Jiri Pechanec
Depends On:
  Show dependency treegraph
Reported: 2013-06-18 07:24 EDT by Jiri Pechanec
Modified: 2014-06-16 19:53 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker SWITCHYARD-1576 Major Closed Allow registration of Channels for stateless sessions 2016-12-01 13:03 EST

  None (edit)
Description Jiri Pechanec 2013-06-18 07:24:23 EDT
In DR5

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?
Comment 1 David Ward 2013-06-24 05:37:04 EDT
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.
Comment 2 Jiri Pechanec 2013-06-24 08:59:12 EDT
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.
Comment 3 David Ward 2013-06-24 09:35:10 EDT
"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.
Comment 4 Tomas Schlosser 2013-06-25 03:09:24 EDT
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.
StatelessKieSession session;
session.execute(cmdFac.newBatchExecution(commands, null));

Edson, could you, please, explain why the channels can't be registered on stateless session directly (the way global variables are)?
Comment 5 Edson Tirelli 2013-06-25 09:42:26 EDT
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?
Comment 6 Edson Tirelli 2013-06-28 16:50:16 EDT
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.


Comment 8 David Ward 2013-07-09 13:10:09 EDT
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...
Comment 9 Edson Tirelli 2013-07-09 18:51:06 EDT
Sorry. My mistake. Flag set.
Comment 10 JBoss JIRA Server 2013-08-01 10:22:38 EDT
David Ward <dward@jboss.org> updated the status of jira SWITCHYARD-1576 to Resolved
Comment 11 JBoss JIRA Server 2013-08-01 10:22:38 EDT
David Ward <dward@jboss.org> made a comment on jira SWITCHYARD-1576

Fixed as part of SWITCHYARD-1623.
Comment 12 Jiri Pechanec 2013-09-19 07:23:07 EDT
Verified in ER2
Comment 16 JBoss JIRA Server 2014-06-16 19:53:48 EDT
Keith Babo <kbabo@redhat.com> updated the status of jira SWITCHYARD-1576 to Closed

Note You need to log in before you can comment on or make changes to this bug.