AnsweredAssumed Answered

Trying to Create Email Listener in Activiti

Question asked by visingh on Jul 20, 2015
Latest reply on Jul 20, 2015 by vasile.dirla
I am new to activiti. I am trying to create Email Listener. This email listener performs below things.
1) Listens email all the time
2) Create task if a new email received.
3) Attach that email to the created task.

I have created two below Process.
1) Process For listening Emails- I am having Receive task and used execution listener by implementing org.activiti.engine.delegate.JavaDelegate. I am having infinite loop to listen the emails in execution method. See code snippet below.
and once I received email I called below second Process.
public void execute(DelegateExecution execution) throws Exception


         downloadEmails("imap", "", "Port", "account", "password", delegateexecution);         

I am using below code to invoke second Process
              RuntimeService runtimeService = execution.getEngineServices().getRuntimeService();
              ProcessInstance piObj= runtimeService.startProcessInstanceByKey("MainProcess", HashTable);
2) Process (MainProcess) is having Manual task and Task listener for this task which creates attachment to the task.

By this approach, I am able to listen emails but unable to create task and I do not recive any error too. Please advise where I am doing wrong or I need to follow some other approach.