You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by wborzynski <wb...@googlemail.com> on 2013/08/07 19:41:04 UTC
Request - response using ProducerTemplate.requestBodyAndHeaders
Hi,
I am trying to use the ProducerTemplate.requestBodyAndHeaders() method to
send an EMS request message to an existing system.
Map<String,Object> headers = new HashMap<String, Object>();
headers.put("form_name","trade_version");
headers.put("JMSCorrelationID", "ID:positionIVCRequest");
headers.put("useMessageIDAsCorrelationID", "true");
Map<String,Object> queryParams= new HashMap<String, Object>();
queryParams.put("a","1");
queryParams.put("b", "2");
javax.jms.TextMessage returnObj =
template.requestBodyAndHeaders("positionEMS:queue:Q.IVCREQUEST?" ,
queryParams, headers, javax.jms.TextMessage.class);
This comes back with a JMS TextMessage reply that I can see in the Camel
logs, but the function call itself always returns null.
I can see the below warning in the logs:
[Camel (CamelContextID) thread #4 -
TemporaryQueueReplyManager[Q.FID.UK.GBB.DBD.CRD.IVCREQUEST]] WARN
org.apache.camel.component.jms.reply.TemporaryQueueReplyManager - Reply
received for unknown correlationID [ID:positionIVCRequest]. The message will
be ignored: TextMessage={ Header={
JMSMessageID={ID:D1_LN_FID_UKB.4694520128E923DF44:4224}
JMSDestination={Queue[$TMP$.D1_LN_FID_UKB.4694520128E924C303.1]}
JMSReplyTo={null} JMSDeliveryMode={NON_PERSISTENT} JMSRedelivered={false}
JMSCorrelationID={ID:positionIVCRequest} JMSType={null}
Tried calling this both with a hard-coded correlation ID:
headers.put("JMSCorrelationID", "ID:positionIVCRequest");
As well as with the useMessageIDAsCorrelationID flag set to true:
headers.put("useMessageIDAsCorrelationID", "true");
Both failed to return a result. Is there anything else I need to set in the
header?
Thanks.
--
View this message in context: http://camel.465427.n5.nabble.com/Request-response-using-ProducerTemplate-requestBodyAndHeaders-tp5736944.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Request - response using ProducerTemplate.requestBodyAndHeaders
Posted by Claus Ibsen <cl...@gmail.com>.
The useMessageIDAsCorrelationID is an option on the Camel JMS
endpoint, not part of the message itself.
And if you want to use a custom correlation id, then the
useMessageIDAsCorrelationID must be false.
On Wed, Aug 7, 2013 at 7:41 PM, wborzynski <wb...@googlemail.com> wrote:
> Hi,
>
> I am trying to use the ProducerTemplate.requestBodyAndHeaders() method to
> send an EMS request message to an existing system.
>
> Map<String,Object> headers = new HashMap<String, Object>();
> headers.put("form_name","trade_version");
> headers.put("JMSCorrelationID", "ID:positionIVCRequest");
> headers.put("useMessageIDAsCorrelationID", "true");
>
> Map<String,Object> queryParams= new HashMap<String, Object>();
> queryParams.put("a","1");
> queryParams.put("b", "2");
>
> javax.jms.TextMessage returnObj =
> template.requestBodyAndHeaders("positionEMS:queue:Q.IVCREQUEST?" ,
> queryParams, headers, javax.jms.TextMessage.class);
>
> This comes back with a JMS TextMessage reply that I can see in the Camel
> logs, but the function call itself always returns null.
>
> I can see the below warning in the logs:
> [Camel (CamelContextID) thread #4 -
> TemporaryQueueReplyManager[Q.FID.UK.GBB.DBD.CRD.IVCREQUEST]] WARN
> org.apache.camel.component.jms.reply.TemporaryQueueReplyManager - Reply
> received for unknown correlationID [ID:positionIVCRequest]. The message will
> be ignored: TextMessage={ Header={
> JMSMessageID={ID:D1_LN_FID_UKB.4694520128E923DF44:4224}
> JMSDestination={Queue[$TMP$.D1_LN_FID_UKB.4694520128E924C303.1]}
> JMSReplyTo={null} JMSDeliveryMode={NON_PERSISTENT} JMSRedelivered={false}
> JMSCorrelationID={ID:positionIVCRequest} JMSType={null}
>
>
> Tried calling this both with a hard-coded correlation ID:
> headers.put("JMSCorrelationID", "ID:positionIVCRequest");
>
> As well as with the useMessageIDAsCorrelationID flag set to true:
> headers.put("useMessageIDAsCorrelationID", "true");
>
> Both failed to return a result. Is there anything else I need to set in the
> header?
>
> Thanks.
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Request-response-using-ProducerTemplate-requestBodyAndHeaders-tp5736944.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen