camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johanes Soetanto <otnat...@gmail.com>
Subject Re: how to obtain camel-smpp submit message id
Date Tue, 11 Dec 2012 22:41:41 GMT
Hi Chris,

On 12 December 2012 06:52, Christian Müller <christian.mueller@gmail.com> wrote:
> The CamelSmppId is set in SmppSubmitSmCommand after the response is
> received from the SMPP. You probably check the header of the wrong message
> (in vs. out).

>From looking at the source code I could see that it is being set on
"CamelSmppId" header by SmppSubmitSmCommand, but seems like I can't
get the header out message. If I use the configuration below

<camel:route id="OutboundRoute" >
   <camel:from uri="outgoingSpringIntegrationChannel"/>
   <camel:to uri="smpp://pavel@localhost:1234?password=wpsd&amp;registeredDelivery=1&amp;..."/>
   <camel:bean ref="messageIdProcessor" method="process"/>
</camel:route>

This is the logging that I receive
2012-12-12 09:00:53,825 DEBUG
[org.apache.camel.component.smpp.SmppSubmitSmCommand] Sending short
message 0 for exchange id 'ID-e6410-48817-1355263252153-0-2'...
2012-12-12 09:00:53,835 DEBUG
[org.apache.camel.component.smpp.SmppSubmitSmCommand] Sent short
message for exchange id 'ID-e6410-48817-1355263252153-0-2' and
received message ids '[Smsc2014]'
Dumping message headers IN
Message id ID-e6410-48817-1355263252153-0-1
Message Headers:
Key:timestamp Value:1355263253800
......
Dumping message OUT
Message id ID-e6410-48817-1355263252153-0-3
Message Headers is null

> The SmppDeliverReceipt also contains the CamelSmppId. With this id, you can
> correlate the asynchronous received response. You can check out the unit
> test if you have problems to get it working [1].

After further debugging it seems like there is a problem with camel
spring integration. it seems like the header from from camel-smpp is
not copied to spring integration message (siMessage). If I debug the
message at the processor. The message is instance of
org.apache.camel.component.spring.integration.SpringIntegrationMessage
which pass all the method calls to the siMessage, so the CamelSmppId
cannot be retrieved unless I temporarily set the siMessage to null.
E.g.

 if (message instanceof SpringIntegrationMessage) {
                    SpringIntegrationMessage siCamelMessage =
(SpringIntegrationMessage)message;
                    org.springframework.integration.Message<?>
siMessage = siCamelMessage.getMessage();
                    siCamelMessage.setMessage(null);
                    Map<String,Object> hhh = siCamelMessage.getHeaders();
                    log.debug("SMPP ID {}", hhh.get(SmppConstants.ID));
                }

Is there a way copy this header without doing custom processor ? something like

<camel-si:copy-header header="CamelSmppId" />

Or there is something wrong with my approach?

Cheers,
Johanes

>
> [1]
> https://svn.apache.org/repos/asf/camel/trunk/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/
>
> Best,
> Christian
>
> On Tue, Dec 11, 2012 at 4:54 AM, Johanes Soetanto <otnateos@gmail.com>wrote:
>
>> logging

Mime
View raw message