10 Replies Latest reply on Jul 31, 2013 10:08 PM by aadav86

    Task notifications in jBPM 5.3

    aadav86

      Hi,

       

       

      Can someone help me with the links leading to examples of Task Notifications. Especially my case is to code/configure task notification to trigger reminder e-mails for multiple tasks(virtual) created by Multiple Instances node.

       

      Thanks,

      Aadav

        • 1. Re: Task notifications in jBPM 5.3
          ashpcs
          • 2. Re: Task notifications in jBPM 5.3
            aadav86

            Hi Ashish,

             

            Thank you, Yes it is for human task only. But I need to send a reminder to the approvers when the task reaches the set expiry deadline. How can I achieve that?

            • 3. Re: Task notifications in jBPM 5.3
              swiderski.maciej

              this sounds like perfect fit for user task deadlines, see docuemntation for more details.

               

              HTH

              • 4. Re: Task notifications in jBPM 5.3
                swiderski.maciej

                One more link that might be useful

                • 5. Re: Task notifications in jBPM 5.3
                  aadav86

                  Hi Maciej,

                   

                   

                  Thank you very much.. let me read through.. But my only challenge is I've kept my Human Task node inside a Multi Instances construct.

                   

                   

                   

                  Thanks,

                  Aadav

                  • 6. Re: Task notifications in jBPM 5.3
                    aadav86

                    Hi Maciejs,

                     

                    As per the documentation I've configured the human task to have expiry period and other user info. Since I've kept the human task node with in a multiple instances construct I've configured the variables that goes with the MI collection item.

                     

                    Now I need to send my own custom email when the deadline is reached. so do I need to write my own listener? As per the documentation I understand that once the email server configuration is done the reminder emails will be triggered..But in my case already I've written down all the method with my own email templates (velocity templates), I just need to invoke the email method from any listener class If I can have.

                     

                     

                    Thanks,

                    Aadav

                    • 7. Re: Task notifications in jBPM 5.3
                      swiderski.maciej

                      I see two options here:

                      • you can define notification body as process variable so it will be resolved at runtime, then you would need to set the process variables for example by invoking some service just before the user task is triggered
                      • you would need to extend the DefaultEscalatedDeadlineHandler to override the executeEmailNotification method to do your custom email processing

                      HTH

                      • 8. Re: Task notifications in jBPM 5.3
                        aadav86

                        Hi Maciejs,

                         

                        Every input of yours is always helpful. Thank you very much. I'll proceed further and will ping you on IRC If I have any doubts.

                         

                        Thanks,

                        Aadav

                        • 9. Re: Task notifications in jBPM 5.3
                          aadav86

                          Hi Maciejs,

                           

                          I've updated my comments on https://issues.jboss.org/browse/JBPM-4078 when you get sometime can you please have a look into it..?

                           

                          Thanks,

                          Aadav

                          • 10. Re: Task notifications in jBPM 5.3
                            aadav86

                            Hi Maciejs,

                             

                             

                            So now the deadlines are created at the database end. And at the scheduled time when the services are attempting to run we get an exception like this.

                             

                            2013-07-30 20:13:13,823 ERROR [org.jbpm.task.service.persistence.TaskPersistenceManager] (pool-20-thread-1) Unable to rollback transaction (or to mark as 'to rollback')!

                            java.lang.NullPointerException

                                      at org.drools.persistence.jta.JtaTransactionManager.getStatus(JtaTransactionManager.java:205)

                                      at org.jbpm.task.service.persistence.TaskJTATransactionManager.rollback(TaskJTATransactionManager.java:51)

                                      at org.jbpm.task.service.persistence.TaskPersistenceManager.rollBackTransaction(TaskPersistenceManager.java:97)

                                      at org.jbpm.task.service.TaskServiceSession.executeEscalatedDeadline(TaskServiceSession.java:1055)

                                      at org.jbpm.task.service.TaskService.executeEscalatedDeadline(TaskService.java:221)

                                      at org.jbpm.task.service.TaskService$ScheduledTaskDeadline.call(TaskService.java:359)

                                      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

                                      at java.util.concurrent.FutureTask.run(FutureTask.java:138)

                                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)

                                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)

                                      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                                      at java.lang.Thread.run(Thread.java:619)

                            2013-07-30 20:13:13,823 ERROR [org.jbpm.task.service.TaskService] (pool-20-thread-1) Could not start transaction.

                            java.lang.RuntimeException: Could not start transaction.

                                      at org.jbpm.task.service.TaskServiceSession.executeEscalatedDeadline(TaskServiceSession.java:1062)

                                      at org.jbpm.task.service.TaskService.executeEscalatedDeadline(TaskService.java:221)

                                      at org.jbpm.task.service.TaskService$ScheduledTaskDeadline.call(TaskService.java:359)

                                      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

                                      at java.util.concurrent.FutureTask.run(FutureTask.java:138)

                                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)

                                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)

                                      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                                      at java.lang.Thread.run(Thread.java:619)

                            Caused by: java.lang.NullPointerException

                                      at org.drools.persistence.jta.JtaTransactionManager.getStatus(JtaTransactionManager.java:205)

                                      at org.jbpm.task.service.persistence.TaskJTATransactionManager.getStatus(TaskJTATransactionManager.java:63)

                                      at org.jbpm.task.service.persistence.TaskJTATransactionManager.begin(TaskJTATransactionManager.java:36)

                                      at org.jbpm.task.service.persistence.TaskPersistenceManager.beginTransaction(TaskPersistenceManager.java:79)

                                      at org.jbpm.task.service.TaskServiceSession.executeEscalatedDeadline(TaskServiceSession.java:1036)

                                      ... 9 more

                            2013-07-30 20:13:14,204 ERROR [org.jbpm.task.service.persistence.TaskPersistenceManager] (pool-21-thread-1) Unable to rollback transaction (or to mark as 'to rollback')!

                            java.lang.NullPointerException

                                      at org.drools.persistence.jta.JtaTransactionManager.getStatus(JtaTransactionManager.java:205)

                                      at org.jbpm.task.service.persistence.TaskJTATransactionManager.rollback(TaskJTATransactionManager.java:51)

                                      at org.jbpm.task.service.persistence.TaskPersistenceManager.rollBackTransaction(TaskPersistenceManager.java:97)

                                      at org.jbpm.task.service.TaskServiceSession.executeEscalatedDeadline(TaskServiceSession.java:1055)

                                      at org.jbpm.task.service.TaskService.executeEscalatedDeadline(TaskService.java:221)

                                      at org.jbpm.task.service.TaskService$ScheduledTaskDeadline.call(TaskService.java:359)

                                      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

                                      at java.util.concurrent.FutureTask.run(FutureTask.java:138)

                                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)

                                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)

                                      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                                      at java.lang.Thread.run(Thread.java:619)

                            2013-07-30 20:13:14,204 ERROR [org.jbpm.task.service.TaskService] (pool-21-thread-1) Could not start transaction.

                            java.lang.RuntimeException: Could not start transaction.

                                      at org.jbpm.task.service.TaskServiceSession.executeEscalatedDeadline(TaskServiceSession.java:1062)

                                      at org.jbpm.task.service.TaskService.executeEscalatedDeadline(TaskService.java:221)

                                      at org.jbpm.task.service.TaskService$ScheduledTaskDeadline.call(TaskService.java:359)

                                      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

                                      at java.util.concurrent.FutureTask.run(FutureTask.java:138)

                                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)

                                      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:207)

                                      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                                      at java.lang.Thread.run(Thread.java:619)

                            Caused by: java.lang.NullPointerException

                                      at org.drools.persistence.jta.JtaTransactionManager.getStatus(JtaTransactionManager.java:205)

                                      at org.jbpm.task.service.persistence.TaskJTATransactionManager.getStatus(TaskJTATransactionManager.java:63)

                                      at org.jbpm.task.service.persistence.TaskJTATransactionManager.begin(TaskJTATransactionManager.java:36)

                                      at org.jbpm.task.service.persistence.TaskPersistenceManager.beginTransaction(TaskPersistenceManager.java:79)

                                      at org.jbpm.task.service.TaskServiceSession.executeEscalatedDeadline(TaskServiceSession.java:1036)

                                      ... 9 more

                             

                            FYI, for now to make this piece work I'm just using DefaultEscalatedDeadlineHandler only. Not extending any custom handler. can you please let me know what am I missing here

                             

                            Thanks,

                            Aadav