You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Johanes Soetanto <ot...@gmail.com> on 2012/12/11 00:47:06 UTC

how to obtain camel-smpp submit message id

Hi,

I would like to know whether there is a way to message from submit sm
for camel-smpp?

I can see from the DEBUG log that there is message id returned from SMSC. e.g.

DEBUG [org.apache.camel.component.smpp.SmppSubmitSmCommand] Sent short
message for exchange id 'ID-e6410-42858-1355182686016-0-2' and
received message ids '[Smsc2024]'

But I can't retrieve the message id header after submitting the sms. I
need to retrieve the message id to cross check with the delivery
receipt coming in and mark the sms sent in our system.

E.g. of my route

<camel:route id="OutboundRoute" >
  <camel:from uri="outgoingSpringIntegrationChannel"/>
  <camel:wireTap uri="log:SMPP-Outbound"/>
  <camel:to uri="smpp://pavel@localhost:1234?password=wpsd&amp;registeredDelivery=1&amp;..."
/>
  <camel:wireTap uri="log:SMPP-Inbound"/>
</camel:route>

Any help or assistance is appreciated.

Thanks,
Johanes Soetanto

Re: how to obtain camel-smpp submit message id

Posted by Christian Müller <ch...@gmail.com>.
I created a ticket [1] and fixed the issue.
The test [2] shows it works now.
It's also back ported to camel 2.10.x and 2.9.x...

[1] https://issues.apache.org/jira/browse/CAMEL-5926
[2]
https://svn.apache.org/repos/asf/camel/trunk/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationTwoWayConsumerTest.java

Best,
Christian

On Wed, Jan 2, 2013 at 9:15 AM, Claus Ibsen <cl...@gmail.com> wrote:

> On Thu, Dec 20, 2012 at 12:58 AM, Johanes Soetanto <ot...@gmail.com>
> wrote:
> > Sorry for the late reply. I have been busy with other project
> >
> > On 15 December 2012 04:36, Christian Müller <ch...@gmail.com>
> wrote:
> >> I checked the code of SpringIntegrationConsumer (I'm not really familiar
> >> with Spring Integration), and I think I see the problem:
> >>
> >> SpringIntegrationConsumer exclusively create InOnly exchanges for the
> >> incoming org.springframework.integration.Message. Because of this, the
> >> Camel SMPP component will set the header CamelSmppId on the in message.
> But
> >> the SpringIntegrationConsumer "only" set the out message into the
> returned
> >> org.springframework.integration.Message. That's the reason why you don't
> >> see it.
> >>
> >> Explicitly setting the exchange pattern should solve your issue:
> >>
> >> <camel:route id="OutboundRoute" >
> >>   <camel:from uri="outgoingSpringIntegrationChannel"/>
> >>   <camel:setExchangePattern pattern="InOut"/>
> >>   <camel:to uri="smpp://pavel@localhost
> >> :1234?password=wpsd&amp;registeredDelivery=1&amp;..."/>
> >>   <camel:bean ref="messageIdProcessor" method="process"/>
> >> </camel:route>
> >
> > I thought first to explicitly set InOut, but that didn't work as well
> > (as of 2.10.3).
> >
> >>
> >> Feel free to raise a JIRA [1] and propose a solution - maybe including a
> >> patch with unit tests [2].
> >> I think the SpringIntegrationConsumer should create InOut or InOnly
> >> exchanges depending on the "inOut" instance variable in
> >> SpringIntegrationEndpoint. Only my 0,02 €...
> >
> > Yep, I guess I have to propose a solution, I also found another
> > problem with the spring-integration component.
> >
>
> Whats that other problem you found?
>
> We love contributions. So patches is welcome
> http://camel.apache.org/contributing.html
>
>
> > Thanks Chris,
> >
> >>
> >> [1] https://issues.apache.org/jira/browse/CAMEL
> >> [2] http://camel.apache.org/contributing.html
> >>
> >> Best,
> >> Christian
> >>
> >> On Tue, Dec 11, 2012 at 11:41 PM, Johanes Soetanto <otnateos@gmail.com
> >wrote:
> >>
> >>> outgoingSpringIntegrationChannel"
> >>>
> >>
> >>
> >>
> >> --
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cibsen@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>



--

Re: how to obtain camel-smpp submit message id

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Dec 20, 2012 at 12:58 AM, Johanes Soetanto <ot...@gmail.com> wrote:
> Sorry for the late reply. I have been busy with other project
>
> On 15 December 2012 04:36, Christian Müller <ch...@gmail.com> wrote:
>> I checked the code of SpringIntegrationConsumer (I'm not really familiar
>> with Spring Integration), and I think I see the problem:
>>
>> SpringIntegrationConsumer exclusively create InOnly exchanges for the
>> incoming org.springframework.integration.Message. Because of this, the
>> Camel SMPP component will set the header CamelSmppId on the in message. But
>> the SpringIntegrationConsumer "only" set the out message into the returned
>> org.springframework.integration.Message. That's the reason why you don't
>> see it.
>>
>> Explicitly setting the exchange pattern should solve your issue:
>>
>> <camel:route id="OutboundRoute" >
>>   <camel:from uri="outgoingSpringIntegrationChannel"/>
>>   <camel:setExchangePattern pattern="InOut"/>
>>   <camel:to uri="smpp://pavel@localhost
>> :1234?password=wpsd&amp;registeredDelivery=1&amp;..."/>
>>   <camel:bean ref="messageIdProcessor" method="process"/>
>> </camel:route>
>
> I thought first to explicitly set InOut, but that didn't work as well
> (as of 2.10.3).
>
>>
>> Feel free to raise a JIRA [1] and propose a solution - maybe including a
>> patch with unit tests [2].
>> I think the SpringIntegrationConsumer should create InOut or InOnly
>> exchanges depending on the "inOut" instance variable in
>> SpringIntegrationEndpoint. Only my 0,02 €...
>
> Yep, I guess I have to propose a solution, I also found another
> problem with the spring-integration component.
>

Whats that other problem you found?

We love contributions. So patches is welcome
http://camel.apache.org/contributing.html


> Thanks Chris,
>
>>
>> [1] https://issues.apache.org/jira/browse/CAMEL
>> [2] http://camel.apache.org/contributing.html
>>
>> Best,
>> Christian
>>
>> On Tue, Dec 11, 2012 at 11:41 PM, Johanes Soetanto <ot...@gmail.com>wrote:
>>
>>> outgoingSpringIntegrationChannel"
>>>
>>
>>
>>
>> --



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: how to obtain camel-smpp submit message id

Posted by Johanes Soetanto <ot...@gmail.com>.
Sorry for the late reply. I have been busy with other project

On 15 December 2012 04:36, Christian Müller <ch...@gmail.com> wrote:
> I checked the code of SpringIntegrationConsumer (I'm not really familiar
> with Spring Integration), and I think I see the problem:
>
> SpringIntegrationConsumer exclusively create InOnly exchanges for the
> incoming org.springframework.integration.Message. Because of this, the
> Camel SMPP component will set the header CamelSmppId on the in message. But
> the SpringIntegrationConsumer "only" set the out message into the returned
> org.springframework.integration.Message. That's the reason why you don't
> see it.
>
> Explicitly setting the exchange pattern should solve your issue:
>
> <camel:route id="OutboundRoute" >
>   <camel:from uri="outgoingSpringIntegrationChannel"/>
>   <camel:setExchangePattern pattern="InOut"/>
>   <camel:to uri="smpp://pavel@localhost
> :1234?password=wpsd&amp;registeredDelivery=1&amp;..."/>
>   <camel:bean ref="messageIdProcessor" method="process"/>
> </camel:route>

I thought first to explicitly set InOut, but that didn't work as well
(as of 2.10.3).

>
> Feel free to raise a JIRA [1] and propose a solution - maybe including a
> patch with unit tests [2].
> I think the SpringIntegrationConsumer should create InOut or InOnly
> exchanges depending on the "inOut" instance variable in
> SpringIntegrationEndpoint. Only my 0,02 €...

Yep, I guess I have to propose a solution, I also found another
problem with the spring-integration component.

Thanks Chris,

>
> [1] https://issues.apache.org/jira/browse/CAMEL
> [2] http://camel.apache.org/contributing.html
>
> Best,
> Christian
>
> On Tue, Dec 11, 2012 at 11:41 PM, Johanes Soetanto <ot...@gmail.com>wrote:
>
>> outgoingSpringIntegrationChannel"
>>
>
>
>
> --

Re: how to obtain camel-smpp submit message id

Posted by Christian Müller <ch...@gmail.com>.
I checked the code of SpringIntegrationConsumer (I'm not really familiar
with Spring Integration), and I think I see the problem:

SpringIntegrationConsumer exclusively create InOnly exchanges for the
incoming org.springframework.integration.Message. Because of this, the
Camel SMPP component will set the header CamelSmppId on the in message. But
the SpringIntegrationConsumer "only" set the out message into the returned
org.springframework.integration.Message. That's the reason why you don't
see it.

Explicitly setting the exchange pattern should solve your issue:

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

Feel free to raise a JIRA [1] and propose a solution - maybe including a
patch with unit tests [2].
I think the SpringIntegrationConsumer should create InOut or InOnly
exchanges depending on the "inOut" instance variable in
SpringIntegrationEndpoint. Only my 0,02 €...

[1] https://issues.apache.org/jira/browse/CAMEL
[2] http://camel.apache.org/contributing.html

Best,
Christian

On Tue, Dec 11, 2012 at 11:41 PM, Johanes Soetanto <ot...@gmail.com>wrote:

> outgoingSpringIntegrationChannel"
>



--

Re: how to obtain camel-smpp submit message id

Posted by Johanes Soetanto <ot...@gmail.com>.
Hi Chris,

On 12 December 2012 06:52, Christian Müller <ch...@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 <ot...@gmail.com>wrote:
>
>> logging

Re: how to obtain camel-smpp submit message id

Posted by Christian Müller <ch...@gmail.com>.
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).
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].

[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 <ot...@gmail.com>wrote:

> logging

Re: how to obtain camel-smpp submit message id

Posted by Johanes Soetanto <ot...@gmail.com>.
On 11 December 2012 13:32, Willem jiang <wi...@gmail.com> wrote:
> You should be able to get the message id from the message header with key "CamelSmppId".
> I found you may use camel-spring-integartion to link the your system with camel.
> You should setup an outputChannel to receive the message which as the message header of "CamelSmppId".
>

How to do that ? from my tests, I can receive the deliver receipt and
strip out the header CamelSmppId. But for my original send request, I
can't get that "CamelSmppId", so delivery receipt is completely
useless because I have no idea which sms related to that delivery
receipt.

I have set up 2 routes for inbound and outbound like below. If I log
the payload and header for "CUSTOMCHANNELTOGETSMPPID", I can't find
"CamelSmppId" even though debug logging from SmppSubmitSmCommand
indicates it receive message id.

<camel:route id="OutboundRoute" >
   <camel:from uri="outgoingSpringIntegrationChannel"/>
   <camel:to uri="smpp://pavel@localhost:1234?password=wpsd&amp;registeredDelivery=1&amp;..."/>
   <camel:wireTap uri="log:SMPP-Inbound"/>
   <camel:to uri="CUSTOMCHANNELTOGETSMPPID"/>
</camel:route>
<camel:route id="InboundRoute">
   <camel:from uri="smpp://pavel@localhost:1234?password=wpsd&amp;registeredDelivery=1&amp;..."/>
   <camel:to uri="incomingSpringIntegrationChannel"/>
</camel>



>
> --
> Willem Jiang
>
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Web: http://www.fusesource.com | http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
>           http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
>
>
> On Tuesday, December 11, 2012 at 7:47 AM, Johanes Soetanto wrote:
>
>> Hi,
>>
>> I would like to know whether there is a way to message from submit sm
>> for camel-smpp?
>>
>> I can see from the DEBUG log that there is message id returned from SMSC. e.g.
>>
>> DEBUG [org.apache.camel.component.smpp.SmppSubmitSmCommand] Sent short
>> message for exchange id 'ID-e6410-42858-1355182686016-0-2' and
>> received message ids '[Smsc2024]'
>>
>> But I can't retrieve the message id header after submitting the sms. I
>> need to retrieve the message id to cross check with the delivery
>> receipt coming in and mark the sms sent in our system.
>>
>> E.g. of my route
>>
>> <camel:route id="OutboundRoute" >
>> <camel:from uri="outgoingSpringIntegrationChannel"/>
>> <camel:wireTap uri="log:SMPP-Outbound"/>
>> <camel:to uri="smpp://pavel@localhost:1234?password=wpsd&amp;registeredDelivery=1&amp;..."
>> />
>> <camel:wireTap uri="log:SMPP-Inbound"/>
>> </camel:route>
>>
>> Any help or assistance is appreciated.
>>
>> Thanks,
>> Johanes Soetanto
>
>
>

Re: how to obtain camel-smpp submit message id

Posted by Willem jiang <wi...@gmail.com>.
You should be able to get the message id from the message header with key "CamelSmppId".
I found you may use camel-spring-integartion to link the your system with camel.
You should setup an outputChannel to receive the message which as the message header of "CamelSmppId".


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Tuesday, December 11, 2012 at 7:47 AM, Johanes Soetanto wrote:

> Hi,
>  
> I would like to know whether there is a way to message from submit sm
> for camel-smpp?
>  
> I can see from the DEBUG log that there is message id returned from SMSC. e.g.
>  
> DEBUG [org.apache.camel.component.smpp.SmppSubmitSmCommand] Sent short
> message for exchange id 'ID-e6410-42858-1355182686016-0-2' and
> received message ids '[Smsc2024]'
>  
> But I can't retrieve the message id header after submitting the sms. I
> need to retrieve the message id to cross check with the delivery
> receipt coming in and mark the sms sent in our system.
>  
> E.g. of my route
>  
> <camel:route id="OutboundRoute" >
> <camel:from uri="outgoingSpringIntegrationChannel"/>
> <camel:wireTap uri="log:SMPP-Outbound"/>
> <camel:to uri="smpp://pavel@localhost:1234?password=wpsd&amp;registeredDelivery=1&amp;..."
> />
> <camel:wireTap uri="log:SMPP-Inbound"/>
> </camel:route>
>  
> Any help or assistance is appreciated.
>  
> Thanks,
> Johanes Soetanto