cancel
Showing results for 
Search instead for 
Did you mean: 

Expose custom JMS TextMessage property to JavaDelegate

karl_berger
Champ in-the-making
Champ in-the-making
I have an Activiti workflow being triggered by a queue via Camel.  Route:

from("activemq:test.queue")
    .log(LoggingLevel.INFO, "Received message ${body}")
    .to("activiti:simpleProcess");


Message send:
TextMessage msg = session.createTextMessage(sw.toString());
msg.setStringProperty("a_value", "12345");


The only Task in simpleProcess is a JavaDelegate which I will be using to interrogate the both the message body and I need exposure to the JMS property that was set on the message.  The message body is visible as variable "camelBody" as expected and I can grab the body data from the DelegateExecution, but no sign of the custom property.

I tried setting "copyVariablesFromProperties=true" on the route per what the user guide seemed to indicate I should do:

from("activemq:test.queue")
    .log(LoggingLevel.INFO, "Received message ${body}")
    .to("activiti:simpleProcess?copyVariablesFromProperties=true");


But that resulted in the following exception:


ERROR DefaultErrorHandler - Failed delivery for (MessageId: ID:U0172348-TPD-A-58680-1405716802892-1:1:1:1:1 on ExchangeId: ID-U0172348-TPD-A-58673-1405716796591-0-1). Exhausted after delivery attempt: 1 caught: org.activiti.engine.ActivitiException: couldn't find a variable type that is able to serialize org.apache.camel.component.jms.JmsBinding@1e707c5
org.activiti.engine.ActivitiException: couldn't find a variable type that is able to serialize org.apache.camel.component.jms.JmsBinding@1e707c5


So how do I get access to these properties?
1 REPLY 1

trademak
Star Contributor
Star Contributor
Thanks for posting this example. There's a problem with copying all properties from Camel to Activiti, in particular the JmsBinding. When copying the JMS message body you only get the text message right? Would it be possible to add the custom property to the text message body? For the property copy failure, would it be possible to create a unit test showing this issue? That would make it a lot easier for us to reproduce and fix it.

Best regards,