[jboss-jira] [JBoss JIRA] Commented: (JBRULES-2554) Adding a StatefulKnowledgeSessionAware Interface
Anatoly Polinsky (JIRA)
jira-events at lists.jboss.org
Tue Jun 22 16:29:46 EDT 2010
[ https://jira.jboss.org/browse/JBRULES-2554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12536734#action_12536734 ]
Anatoly Polinsky commented on JBRULES-2554:
-------------------------------------------
This can be used by developers implementing custom behavior, but one frequent usage for this is when registering WorkItemHandler
{code}
if ( wih instanceof StatefulKnowledgeSessionAware ) {
( ( StatefulKnowledgeSessionAware ) wih ).setStatefulKnowledgeSession( ksession );
}
{code}
which would make more sense to be done by the framework itself, because the case is quite common where a work item handler need an access to a session for various reasons.
so, the above code snippet would belong to XyzWorkItemManager:
{code}
public void registerWorkItemHandler(String workItemName, WorkItemHandler handler) {
// HERE
this.workItemHandlers.put(workItemName, handler);
}
{code}
/Anatoly
> Adding a StatefulKnowledgeSessionAware Interface
> ------------------------------------------------
>
> Key: JBRULES-2554
> URL: https://jira.jboss.org/browse/JBRULES-2554
> Project: Drools
> Issue Type: Feature Request
> Security Level: Public(Everyone can see)
> Components: drools-api
> Affects Versions: 5.1.0.M2
> Environment: N/A
> Reporter: Anatoly Polinsky
> Assignee: Mark Proctor
> Priority: Minor
> Attachments: StatefulKnowledgeSessionAware.java
>
> Original Estimate: 1 hour
> Remaining Estimate: 1 hour
>
> Interface to be implemented by any object that wishes to be notified of the {@link org.drools.runtime.StatefulKnowledgeSession} that it runs in.
> Implementing this interface makes sense for example when an object requires access to session artifacts/details such as rule facts, sessionID, etc.
>
> This interface can be implemented by a custom {@link org.drools.process.instance.WorkItemHandler} in case, for example, it needs to access a session to insert / retract some facts before proceeding further to the process node that fires rules ( groups, agendas, etc.. ).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list