1 Reply Latest reply on Dec 4, 2006 12:57 PM by cocampo

    need help to set a task

    blai

      Hi you there,

      I am testing JBPM and in doing so I am building my first application. I mean to set a task that would send emails. I looked throughout this forum and all docs at hand but no luck in finding an answer to my problem: I want to know how to set a task that send emails within the XML configuration file and how can I provide the task handler class the parameters needed to do so.
      Honestly I haven`t found a clear example.

      May anyone help me?

      Thanks a lot for your help.

      Blai

        • 1. Re: need help to set a task

          To declare an action that sends mails as you "enter" a task:

           <task-node name="1a revision contrato">
           ...
           <task name="revision_contrato_1">
           <timer
           name="send_mail"
           duedate="5 seconds"
           repeat="7 days">
           <action
           class='com.timers.test.MailSender' />
           </timer>
           </task>
           ...
           </task-node>
          


          Here's a snippet from MailSender class:

          public class MailSender implements ActionHandler {
          ...
           public void execute(ExecutionContext executionContext) throws Exception {
           MailSender ms = new MailSender();
           ...
           ms.send();
           ...
          


          Also, in order to activate timers, I'm declaring the next in my web.xml file:

           <servlet>
           <servlet-name>JbpmThreadsServlet</servlet-name>
           <servlet-class>org.jbpm.web.JbpmThreadsServlet</servlet-class>
           <load-on-startup>1</load-on-startup>
           </servlet>
          


          If you have the jbpm.war in the same app server, you don't need to declare it.

          Regards.