Hi Carolin.
Strange – did not find this thread on google groups anymore? I wanted to ask if this is solved in the meanwhile?
Cheers
Bernd
Von: camunda-...@googlegroups.com [mailto:camunda-...@googlegroups.com] Im Auftrag von Carolin Dettling
Gesendet: Montag, 7. Oktober 2013 17:33
An: camunda-...@googlegroups.com
Betreff: [camunda-bpm-users] Messaging between two processes by using camel
Hi at all,
I've got a question about sending messages between two processes. I did the following in my Camel-Route-Builder:
from("direct://direct1")
.routeId("direct1")
.to("log:com.via.camunda.bpm.camel?level=INFO&showAll=true&multiline=true")
.process(new Processor() {
public void process(Exchange arg0) throws Exception {
processInstanceIdProcess1 = (String) arg0.getProperties().get("CamundaBpmProcessInstanceId");
log.info("\"ProcessInstanceId\" von routeId=" + arg0.getFromRouteId() + " ist: "+ processInstanceIdProcess1);
}
})
.to("camunda-bpm:start?processDefinitionKey=process2©BodyAsVariable=ask&waitForTaskToComplete=Never")
.end().process(new Processor() {
public void process(Exchange arg1) throws Exception {
processInstanceIdProcess2 = (String) arg1.getProperties().get("CamundaBpmProcessInstanceId");
log.info("\"ProcessInstanceId\" von Process2 ist: " + processInstanceIdProcess2);
}
});
from("direct://direct2")
.routeId("direct2")
.to("seda:direct3?waitForTaskToComplete=Never");
from("seda://direct3")
.routeId("direct3")
.process(new Processor() {
public void process(Exchange arg0) throws Exception {
runtimeService = ProcessEngines.getDefaultProcessEngine().getRuntimeService();
ProcessInstance pi = runtimeService.startProcessInstanceById(processInstanceIdProcess1);
log.info("Process Instance: " + pi);
}
})
.to("camunda-bpm:message?messageName=procss1.answer&processDefinitionKey=process1");
The first route does work fine and starts the second process. But I don't know, how to send the answer in the correct way. The first process is waiting for an (intermediate catch) message event.
By sending the answer, I get the following stacktrace:
INFO bpm.camel - Exchange[
, Id: xxx
, ExchangePattern: InOut
, Properties: {CamelCreatedTimestamp=Mon Oct 07 17:09:54 CEST 2013, CamelMessageHistory=[DefaultMessageHistory[routeId=direct1, node=to6]], CamelToEndpoint=log://com.via.camunda.bpm.camel?level=INFO&multiline=true&showAll=true, CamundaBpmProcessInstanceId=810f97a4-2f62-11e3-b62e-0022190e09a4}
, Headers: {breadcrumbId=xxx}
, BodyType: java.util.HashMap
, Body: {}
, Out: null:
]
Okt 07, 2013 5:09:54 PM com.via.camunda.bpm.camel.MyCamelRouteBuilder$4 process
INFO: "ProcessInstanceId" von routeId=direct1 ist: 810f97a4-2f62-11e3-b62e-0022190e09a4
Okt 07, 2013 5:09:54 PM org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer deploy
...
Okt 07, 2013 5:09:54 PM com.via.camunda.bpm.camel.MyCamelRouteBuilder$3 process
INFO: "ProcessInstanceId" von Process2 ist: 1
ERROR processor.DefaultErrorHandler - Failed delivery for (MessageId: ... on ExchangeId: xxx). Exhausted after delivery attempt: 1 caught: org.camunda.bpm.engine.ProcessEngineException: no deployed process definition found with id '810f97a4-2f62-11e3-b62e-0022190e09a4'
Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId ProcessorId Processor Elapsed (ms)
[direct3 ] [direct3 ] [seda://direct3 ] [ 14]
[direct2 ] [to8 ] [seda:direct3?waitForTaskToComplete=Never ] [ 1]
[direct3 ] [process5 ] [com.via.camunda.bpm.camel.MyCamelRouteBuilder$5@1ce5f5a4 ] [ 9]
Exchange
---------------------------------------------------------------------------------------------------------------------------------------
Exchange[
Id xxx
ExchangePattern InOut
Headers {breadcrumbId=xxx, CamelRedelivered=false, CamelRedeliveryCounter=0}
BodyType java.util.HashMap
Body {process1.answer=answer, CamundaBpmProcessInstanceId=810f97a4-2f62-11e3-b62e-0022190e09a4}
]
Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
org.camunda.bpm.engine.ProcessEngineException: no deployed process definition found with id '810f97a4-2f62-11e3-b62e-0022190e09a4'
....
Exchange[Message: {process1.answer=answer, CamundaBpmProcessInstanceId=810f97a4-2f62-11e3-b62e-0022190e09a4}]. Caused by: [org.camunda.bpm.engine.ProcessEngineException - no deployed process definition found with id '810f97a4-2f62-11e3-b62e-0022190e09a4']
If I change the route from direct3 like this:
from("seda://direct3")
.routeId("direct3")
.to("camunda-bpm:message?messageName=procss1.answer&processDefinitionKey=process1");
The stack says this:
INFO: "ProcessInstanceId" von routeId=direct1 ist: 0dbdc63a-2f65-11e3-b62e-0022190e09a4
...
INFO: "ProcessInstanceId" von Process2 ist: 101
...
Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
java.lang.RuntimeException: Couldn't find waiting process instance with id '101' for message 'procss1.answer'
Does anybody know/find my mistake?
Thanks and Cheers,
Caro
--
You received this message because you are subscribed to the Google Groups "camunda BPM users & process application developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camunda-bpm-us...@googlegroups.com.
To post to this group, send email to camunda-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/camunda-bpm-users/2a1418c9-c20e-478e-94a0-1267907f2e1e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
...
java.lang.RuntimeException: Couldn<span cl
Hi Carolin.
OK – perfect – thanks for the feedback.
And maybe it would be better to quickly answer that is was solved next time (maybe even with some information how if anybody else experiences the same problem).
Thanks and Cheers
Bernd
--
You received this message because you are subscribed to the Google Groups "camunda BPM users & process application developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camunda-bpm-us...@googlegroups.com.
To post to this group, send email to camunda-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/camunda-bpm-users/8a21ace5-2b1e-403a-8a2c-eb079c12d78d%40googlegroups.com.
Could you then repost the question? I think it got lost by deleting it (and I deleted the mail locally in the meantime ;-)).
--
You received this message because you are subscribed to the Google Groups "camunda BPM users & process application developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camunda-bpm-us...@googlegroups.com.
To post to this group, send email to camunda-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/camunda-bpm-users/c0cb4109-76a0-4af3-b243-66d0e7e3a6f0%40googlegroups.com.
java.lang.RuntimeException: Couldn't find waiting process instance with id '101' for message 'procss1.answer'
// correlate with message
ProcessEngines.getDefaultProcessEngine().getRuntimeService().correlateMessage(procss1.answer
);
.to("camunda-bpm:message?messageName=procss1.answer&processDefinitionKey=process1");
<bpmn2:message id="Message_3" name="AFI_GENERATED"/>
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_2">
<bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
<bpmn2:messageEventDefinition id="_MessageEventDefinition_2" messageRef="Message_3"/>
</bpmn2:intermediateCatchEvent>
Then I use from my Camel route this processor to try to send my message back to my process:
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
ProcessEngines.getDefaultProcessEngine().getRuntimeService().correlateMessage("AFI_GENERATED");
}
});
But It gives me this error now:
org.camunda.bpm.engine.MismatchingMessageCorrelationException: Cannot correlate message AFI_GENERATED: No process definition or execution matches the parameters
I made sure that the header CamundaBpmProcessInstanceId is in place:
Headers:{CamundaBpmProcessInstanceId=8101, channelId=null, breadcrumbId=ID-alfonso-mbp-2-local-50518-1394121195821-0-9, fileName=afiliacion.afi}
What else am I missing?
Thanks in advance...
Hi Alfonso.
If you write your own Processer (and not use the pre-built endpoint “camunda-bpm://message”) you have to call the correct API:
corrleateMessage takes a second parameter with the correlation parameters. This is important to get going.
In the endpoint we implemented it like this: https://github.com/camunda/camunda-bpm-camel/blob/master/camunda-bpm-camel-common/src/main/java/org/camunda/bpm/camel/component/producer/MessageProducer.java#L100
Von: camunda-...@googlegroups.com [mailto:camunda-...@googlegroups.com] Im Auftrag von Alfonso Mateos Alarcón
Gesendet: Donnerstag, 6. März 2014 17:16
An: camunda-...@googlegroups.com
Betreff: Re: [camunda-bpm-users] Messaging between two processes by using camel
It doesn't work for me, even when I use correlateMessage...
--
You received this message because you are subscribed to the Google Groups "camunda BPM users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camunda-bpm-us...@googlegroups.com.
To post to this group, send email to camunda-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/camunda-bpm-users/4148601a-aef0-4b85-8178-70db1184a7d3%40googlegroups.com.
Sorry – wrong shortcut – sent the message without finishing it ;-) But I hope that already helps?
--
Cheers
Bernd
Consultant & Evangelist (www.camunda.org/community/team.html)
We are hiring: http://www.camunda.org/community/jobs.html
To view this discussion on the web visit https://groups.google.com/d/msgid/camunda-bpm-users/b9d93797.00000fac.000000c4%40ca-ruecker.