3 Replies Latest reply on Jan 30, 2013 4:47 PM by vchmakov

    Design advice: multi-day scenario

    jhl

      Hi,

       

      I've been trying to think of the best process design workflow for my use case, and need some guidance.

       

      Here's the scenario (simplified for the sake of discussion):

       

      We have a list of customers that we want to send emails to, but after certain days after their account has been activated. 

      When an account is created, kick off the workflow

      @ 10 days after activation, send email A

      @ 20 days after activation, send email B

      @ 30 days after activation, send email C

      @ 45 days after activation, send email D

      @ 60 days after activation, remove from workflow

      The number of days after activation increments daily

      There are a few events that would remove the customer from the workflow, (i.e. "unsubscribe") - these events can come from a 3rd party system. 

       

      //

       

      My question is what is the best way to model this behavior ?   I thought that jBPM would be the best solution because the progression of each step is fairly linear.  The exception is the ability to take in an event that removes the customer from the workflow. 

       

      Any advice would be greatly appreciated.  Thank you.

        • 1. Re: Design advice: multi-day scenario
          vchmakov

          Hi,

           

          This process is executed by scheduler periodically, e.g. daily:

          Select Customer.ID Customer where Today-Customer.ActivationDay = 10 and Customer.Status <> “No Mail” -> send email A

          Select Customer.ID Customer where Today-Customer.ActivationDay = 20 and Customer.Status <> “No Mail” -> send email B

          Select Customer.ID Customer where Today-Customer.ActivationDay = 30 and Customer.Status <> “No Mail” -> send email C

          Select Customer.ID Customer where Today-Customer.ActivationDay = 45 and Customer.Status <> “No Mail” -> send email D

          Select Customer.ID Customer where Today-Customer.ActivationDay = 60 and Customer.Status <> “No Mail” -> update Customer set Customer .status=“No Mail” where Customer.ID=?

           

          This process is triggered by “Unsubscribe” event:

          Select * from Customer where Customer.ID = ? -> update customer set status=“No Mail” where Customer.ID=?

           

          In my opinion this use case fits perfectly for the Drools implementation (event/rule driven), but has nothing to do with jBPM. Maybe there is something not mentioned above that can be implemented in jBPM, but it is always easy to do implementing a rule in certain way.

           

          Thanks,

           

          Vladimir

          • 2. Re: Design advice: multi-day scenario
            jhl

            Thanks for your reply, Vladimir - this is helpful.

             

            I guess this can be done in drools fusion (or drools classic), but does fusion support the persistence of state?  For example, on a daily basis the number of days since creation will increment for each customer - there may also be other events that will modify other settings.  I want this to be stored.  This is also why I wanted to use jbpm. 

            • 3. Re: Design advice: multi-day scenario
              vchmakov

              Hi,

               

              That’s the point - you do not need to store the number of days since creation, you calculate it: Today-Customer.ActivationDay. Other parameters are also persisted in your data model, e.g. update Customer set Customer .status=“No Mail” where Customer.ID=? etc. Why would you use jBPM persistence to store the values which belong to YOUR business logic? jBPM is about to help you solving other problems. I’m not saying that there is no use of it in your project, but what you have described above in not for jBPM implementation in my opinion. That’s all I’m trying to say.

               

              Thanks,

               

              Vladimir