NPE when trying to signal Receive Task
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-13-2014 05:10 AM
Hello everyone,
I'm trying to model a process where users receive a mail after which they need to verify that they read it. If they haven't verified after a certain period, another mail should be send. This should continue indefinitely until either all users have verified the mail or someone overrides the process.
The following schema shows how I modeled the happy flow where users always immediately verify upon receiving the mail.
http://imgur.com/Rd3Ojby
The sub-process is called for each e-mail in a collection of e-mails that is set on the process context when starting the process. The "Send mail" ServiceTask sends an e-mail to someone with the execution ID in the message body. (DelegateExecution.getId()) Using the console, I enter the number and call RuntimeService.signal(id) where id is the number I just received from the mail. Once I do this for all e-mails, the process continues as expected and "Hello World" is printed to the console.
Next, I try to send an e-mail every n-period while no signal has been received.
http://imgur.com/4AUDEDq
When I run this process, I will indeed get an e-mail every n-period. However, when I now signal the execution ID I get the exception as shown in the image.
Is this the right way to model what I'm trying to achieve? If so, how can I resolve this issue? If not, how would you recommend these requirements to be modeled?
Thank you very much,
Davey
I'm trying to model a process where users receive a mail after which they need to verify that they read it. If they haven't verified after a certain period, another mail should be send. This should continue indefinitely until either all users have verified the mail or someone overrides the process.
The following schema shows how I modeled the happy flow where users always immediately verify upon receiving the mail.
http://imgur.com/Rd3Ojby
The sub-process is called for each e-mail in a collection of e-mails that is set on the process context when starting the process. The "Send mail" ServiceTask sends an e-mail to someone with the execution ID in the message body. (DelegateExecution.getId()) Using the console, I enter the number and call RuntimeService.signal(id) where id is the number I just received from the mail. Once I do this for all e-mails, the process continues as expected and "Hello World" is printed to the console.
Next, I try to send an e-mail every n-period while no signal has been received.
http://imgur.com/4AUDEDq
When I run this process, I will indeed get an e-mail every n-period. However, when I now signal the execution ID I get the exception as shown in the image.
Is this the right way to model what I'm trying to achieve? If so, how can I resolve this issue? If not, how would you recommend these requirements to be modeled?
Thank you very much,
Davey
Labels:
- Labels:
-
Archive
6 REPLIES 6
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2014 02:21 AM
Hi Davey,
Could you create jUnit test to reproduce this exception?
To solve your problem use following jUnit test from activiti source:
org.activiti.engine.test.bpmn.event.timer.IntermediateTimerEventTest#testLoop
Regards
Martin
Could you create jUnit test to reproduce this exception?
To solve your problem use following jUnit test from activiti source:
org.activiti.engine.test.bpmn.event.timer.IntermediateTimerEventTest#testLoop
Regards
Martin
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-16-2015 05:32 AM
Hello Martin,
I reproduced the problem via JUnit test as requested.
Kind regards,
Davey
I reproduced the problem via JUnit test as requested.
Kind regards,
Davey
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2014 02:42 AM
Hello Davey,
Thank you for the jUnit test - it makes things much easier.
I cloned it - but I do not have access to push changes and I do not want to fork your repository. That's why I post the solution here:
Regards
Martin
Thank you for the jUnit test - it makes things much easier.
I cloned it - but I do not have access to push changes and I do not want to fork your repository. That's why I post the solution here:
@Test
@Deployment(resources = {"diagrams/MyProcess.bpmn"})
public void testName() {
ProcessInstance pi = rule.getRuntimeService().startProcessInstanceByKey("myProcess");
Execution execution = rule.getRuntimeService().createExecutionQuery()
.processInstanceId(pi.getId())
.activityId("receivetask1")
.singleResult();
assertNotNull(execution);
rule.getRuntimeService().signal(execution.getId());
assertThat("after the receive task [receivetask1] all process instances are finished",
rule.getRuntimeService().createProcessInstanceQuery().count(), is(0L));
}
Regards
Martin
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-16-2014 03:41 AM
Your unit test works exactly as required. Thank you Martin! Is there an expected way to mark this topic as solved?
Kind regards,
Davey
Kind regards,
Davey
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2014 05:46 AM
No, sorry, no such feature here. But thanks for posting back that it works 🙂
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2015 03:13 AM
Hi Davey,
I have a requirement wherein I am using a receive task to make a process wait until the receive task gets the required ID to continue the process.I have referred the following link:http://forums.activiti.org/content/correct-way-signal-receivetask but could not achieve the desired as I am getting errors in the code.Can you help with your code for my reference.
I have a requirement wherein I am using a receive task to make a process wait until the receive task gets the required ID to continue the process.I have referred the following link:http://forums.activiti.org/content/correct-way-signal-receivetask but could not achieve the desired as I am getting errors in the code.Can you help with your code for my reference.