[rules-users] Drools flow ; events with AND join , persistence for flows, being able to suspend and resume flows, and long wait states

shoukry kattan kattan.shoukry at gmail.com
Sun Jun 13 19:49:14 EDT 2010


I was able to figure out the issue of the AND join and Events.
Apparently in the SendSMSWorkItemHandler i did not mark the Work item as
done

workItemHandler.completeWorkItem(workItem.getId(), null);

therefore the entire flow was stuck waiting for my work item to complete.

Feedback is still needed for the other questions.

Thank you



On Sun, Jun 13, 2010 at 9:50 PM, shoukry kattan <kattan.shoukry at gmail.com>wrote:

> Dear All,
>
> I have been evaluating a number of frameworks including jBPM and Drools
> flow for my application requirements. Lots of the opinions seem to be
> inclined towards Drools flow as its more flexible, knowledge oriented,
> easier to integrate with business rules, etc..
>
> The application is some sort of an Email Campaign manager , where different
> customers can sign in, prepare (design) and launch email campaigns.
>
> The application should be able to do the following :
>
> 1- Receive a list of email addresses, send emails to each of these
> addresses starting from a certain date and during a certain time interval of
> the day , do some custom actions, and then wait for reply emails.
> 2- If a reply email is received  and depending on the response text of the
> email , and depending on the time the email was received certain actions
> need to happen, web service calls need to take place, and error handling for
> these calls.
> 3- The application will manage and run many and different campaigns
> (different customers and different flows for each customer) at any point of
> time.
>
>
> *The first question is : *
> Is Drools flow the way to go about this?
> My main concerns are scalability, suspending, resuming flows, and long
> wait, and flows management.
>
> As you see from the requirements :
> *There is a scheduling part :*
> Certain flows need to be run at a certain point in time, they need to get
> suspended and then resumed.
> For example start sending emails starting on Dec 1st 2010  and send emails
> only in the time interval between 08:00  and 17:00 GMT. By then it might be
> that all subscribers have been sent emails, but it might not be the case,
> the process needs to (resume) on Dec 2nd and send a second batch, however
> certain (users) already received emails and they should be able to (continue
> at different stages of the flow)
>
> *There are long wait states : *
> Days or even weeks , i need to persist, suspend / resume and terminate
> flows (manage flows)
>
> *External Events :
> *
> This is where i got stuck first, i tried to put together a simple flow (see
> attached screenshot) , there is a start node , connected to an action node,
> connected to a join.
> An event node is connected to a second action node, which is connected to
> the join. The join is an AND join , after the join there is an action and
> the end node.
>
> Here is the sample code i am using to launch the flow :
>
>
>         KnowledgeBuilder builder = KnowledgeBuilderFactory
>                 .newKnowledgeBuilder();
>         builder.add(ResourceFactory.newClassPathResource("campaign.rf",
>                 CampaignsDroolsPoc.class), ResourceType.DRF);
>
>         if (builder.hasErrors()) {
>             KnowledgeBuilderErrors errors = builder.getErrors();
>             Iterator<KnowledgeBuilderError> iterator = errors.iterator();
>             while (iterator.hasNext()) {
>                 System.out.println(iterator.next().toString());
>             }
>
>         }
>
>         KnowledgeBase base = KnowledgeBaseFactory.newKnowledgeBase();
>         base.addKnowledgePackages(builder.getKnowledgePackages());
>
>         final StatefulKnowledgeSession ksession = base
>                 .newStatefulKnowledgeSession();
>
>         // KnowledgeRuntimeLoggerFactory.newConsoleLogger(ksession);
>
>         ksession.getWorkItemManager().registerWorkItemHandler("Log",
>                 new SendSMSWorkItemHandler());
>
>         ProcessInstance startProcess = ksession.startProcess("flow");
>
>         System.out.println("Signaling event");
>
>         startProcess.signalEvent("ev1", "ev1");
>
>         System.out.println("Signaled");
>
>         ksession.fireUntilHalt();
>
>
> I am noticing that the event get triggered, the action node connected to
> the event gets triggered, however things seem to get stuck at the join. The
> flow does not continue past the AND join and the flow seems to get stuck.
> The action following the node does not get triggered.
>
> I have seen the post about the Manufacturing process , however there is no
> code sample of how this guy got that to work.
>
> http://drools-java-rules-engine.46999.n3.nabble.com/DROOLS-Flow-as-a-Manufacturing-process-execution-engine-Noob-questions-about-events-and-concurrency-td706102.html
>
> I also went through the drools flow documentation , and all the example
> codes, however i didn't find anything there.
>
> In addition any hints about the way to go about architecting the solution,
> and implementing it would be great.
>
> While googling I noticed that there are many more jBPM examples than drools
> flow and this is not so good for guys like me trying to get started.
> If you help me guys I would be glad to post the entire Proof of concept I
> am working on as a drools flow example.
>
>
> Regards,
>
> Shoukry Kattan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100614/c4fa23a0/attachment.html 


More information about the rules-users mailing list