hi community,
i still face some struggles concering my process variable camel integration with camunda.
let me explain with this simple process. when a certain file is dropped it should trigger the process. the userTask is actually empty.
according to GitHub - camunda-community-hub/camunda-bpm-camel: Community Extension to add Apache Camel support for Camunda BPM i added “copyProperties” to my endpoint because i want to have the properties passed to the process engine. i actually want to pass the filename (+path).
from("file://" + SOURCE_FOLDER)
.convertBodyTo(String.class)
.choice()
.when(builder)
.setProperty("kunde", xpath("*//Kunde/text()"))
.to("file://" + XML_FOLDER)
.to("camunda-bpm:start?processDefinitionKey=Process_ReceivedXML©Properties")
.otherwise()
.to("file://" + MOVED_FOLDER)
.to("camunda-bpm:message?messageName=camel.start")
.end().process(new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.setPattern(ExchangePattern.InOut);
exchange.setProperty("testProperty", "testValue");
System.out.println("===============");
System.out.println("Processing file: " + exchange.getProperty("CamelFileExchangeFile"));
System.out.println("===============");
System.out.println(exchange.getProperties());
}
});
(please note that i just picked some random variables. i will insert the filepath later when it works)
i was not sure if the property must be set before the process(Exchange exchange) starts or afterwards therefore i added a property before and after this method which results in the following:
17:20:03,463 INFO [stdout] (Camel (camel-1) thread #1 - file://X:%5COV%5CBeispieldaten%5CIncome) {} ===============
17:20:03,463 INFO [stdout] (Camel (camel-1) thread #1 - file://X:%5COV%5CBeispieldaten%5CIncome) {} Processing file: GenericFile[X:\OV\Beispieldaten\Income\Rechnung.xml]
17:20:03,463 INFO [stdout] (Camel (camel-1) thread #1 - file://X:%5COV%5CBeispieldaten%5CIncome) {} ===============
17:20:03,463 INFO [stdout] (Camel (camel-1) thread #1 - file://X:%5COV%5CBeispieldaten%5CIncome) {} {CamelBatchSize=1, testProperty=testValue, CamelMessageHistory=[DefaultMessageHistory[routeId=route1, node=convertBodyTo1], DefaultMessageHistory[routeId=route1, node=choice1], DefaultMessageHistory[routeId=route1, node=setProperty1], DefaultMessageHistory[routeId=route1, node=to1], DefaultMessageHistory[routeId=route1, node=to2], DefaultMessageHistory[routeId=route1, node=process1]], CamelBatchComplete=true, CamelExternalRedelivered=false, CamelCreatedTimestamp=Thu Mar 26 17:20:03 CET 2020, CamelFileExchangeFile=GenericFile[X:\OV\Beispieldaten\Income\Rechnung.xml], CamundaBpmProcessInstanceId=a5fabea6-6f7d-11ea-98b4-40b076df2e43, CamundaBpmProcessDefinitionId=Process_ReceivedXML:16:8bcfd4ba-6f7d-11ea-98b4-40b076df2e43, CamelBatchIndex=0, CamelToEndpoint=camunda-bpm://start?amp%3BcopyProperties=&processDefinitionKey=Process_ReceivedXML, kunde=org.apache.xml.dtm.ref.DTMNodeList@312107d3}
so both properties (‘kunde’ and ‘testProperty’) can be retrieved with getProperties(). but when i claim the userTask and click on “load variables” none of my properties are shown, only “camelBody”… i dont get whats wrong?! can someone help me?