You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by fclose <fr...@closebase.com> on 2013/03/25 16:14:20 UTC

SMPP stop route problem

Hello,


like I explained in a previous post I'm looking for recommendations about
how to stop a route listening for sms messages. 

Currently I'm stopping the route using the camel context 

camelContext.stopRoute(routeId); 

But doing so I'm losing some messages :
Here is the description of the problem from the guys at smsc side :

My application returns an error code FF (Hex) or 255 (Dec) before unbinding.
Then SMSc will mark the message as an “invalid” and all next messages which
will be sent  towards the same destination MSISDN will be put automatically 
to “undeliverable” and no delivery attempt will be made until the
application connects again and starts accepting messages again for this
destination MSISDN.
 
As error code FF or 255 is not according the SMPP specifications, the SMSc
will consider it as a permanent error (241). 






--
View this message in context: http://camel.465427.n5.nabble.com/SMPP-stop-route-problem-tp5729769.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: SMPP stop route problem

Posted by fclose <fr...@closebase.com>.
Hello Christian thanks for your answer,

I'll ask the SMSC specialist why the error 255 is unknown at the smsc level
(could depend on the smsc manufacturer ?).

Concerning the stop of the route, I saw in the logs that a gracefull
shutdown happens [logs],  it happens fast (1 second) but the route is
receiving  2 messages per second and I have the feeling that a message is
still received by the consumer after the stop and that's when the problem
appears.

I'll redo some tests tomorrow and I hope I'll be able to confirm that.

In the logs, I can see that is shutting down with "CompleteCurrentTaskOnly"
option, are there other options for the stop of an individual route ? 



[logs]
2013-03-22 15:22:43,346 DEBUG There are 1 routes to shutdown
2013-03-22 15:22:43,347 TRACE Shutting down route: smsReceivingRoute with
options [Default,CompleteCurrentTaskOnly]
2013-03-22 15:22:43,348 TRACE Suspending:
SmppConsumer[smpp://*******************]
2013-03-22 15:22:43,349 TRACE Suspend complete for:
SmppConsumer[smpp://**************]
2013-03-22 15:22:43,351 DEBUG Route: smsReceivingRoute suspended and
shutdown deferred, was consuming from: Endpoint[smpp://***************]
2013-03-22 15:22:43,352 TRACE Shutting down:
SmppConsumer[smpp://********************]
2013-03-22 15:22:43,352 DEBUG Disconnecting from:
smpp://********************...
2013-03-22 15:22:43,352 DEBUG Stopping consumer:
SmppConsumer[smpp://********************]
2013-03-22 15:22:44,363 DEBUG Activity notified
2013-03-22 15:22:44,364 INFO  PDUReaderWorker stop
2013-03-22 15:22:44,365 DEBUG unbind response received
2013-03-22 15:22:44,366 INFO  Disconnected from: smpp://********************
2013-03-22 15:22:44,367 TRACE Shutdown complete for:
SmppConsumer[smpp://********************]
2013-03-22 15:22:44,370 INFO  Route: smsReceivingRoute shutdown complete,
was consuming from: Endpoint[smpp://********************]
2013-03-22 15:22:44,370 INFO  Graceful shutdown of 1 routes completed in 1
seconds
2013-03-22 15:22:44,372 INFO  Route: smsReceivingRoute is stopped, was
consuming from: Endpoint[smpp://********************]
2013-03-22 15:22:44,373 INFO  Status Started waiting for stopped.
2013-03-22 15:22:44,507 INFO  EnquireLinkSender stop



--
View this message in context: http://camel.465427.n5.nabble.com/SMPP-stop-route-problem-tp5729769p5729872.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: SMPP stop route problem

Posted by Christian Müller <ch...@gmail.com>.
Please find my comments inline...

Best,
Christian


On Wed, Mar 27, 2013 at 9:04 AM, fclose <fr...@closebase.com> wrote:

> Christian, I still have a question about what you said
>
>
>
> Christian Mueller wrote
> > If you want to return another error code, simply catch the exception in
> > your route and rethrow an org.jsmpp.extra.ProcessRequestException (with
> > the
> > error code you want) which is returned to the SMSC.
>
>
> As my route is defined using the spring dsl and looks like below, how would
> you recommend me to catch the exception and throw another one ?
>
Exactly. You can use the doTry() doCatch() DSL.


> using a failure handler ?
> maybe it would be converting the route to the java dsl
>
>
>
> <camel:errorHandler id="smsReceivingErrorHandler" type="DeadLetterChannel"
> deadLetterUri="smsReceivingDLQueue">
>     <camel:redeliveryPolicy maximumRedeliveries="0" logStackTrace="true"
> logHandled="false"/>
> </camel:errorHandler>
>
>
> <camel:route id="smsReceivingRoute" autoStartup="false"
> errorHandlerRef="smsReceivingErrorHandler">
>     <camel:from ref="smscReceiving"/>
>     <camel:to ref="smsProcessing"/>
> </camel:route>
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/SMPP-stop-route-problem-tp5729769p5729903.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: SMPP stop route problem

Posted by fclose <fr...@closebase.com>.
Christian, I still have a question about what you said



Christian Mueller wrote
> If you want to return another error code, simply catch the exception in
> your route and rethrow an org.jsmpp.extra.ProcessRequestException (with
> the
> error code you want) which is returned to the SMSC.


As my route is defined using the spring dsl and looks like below, how would
you recommend me to catch the exception and throw another one ?
using a failure handler ? 
maybe it would be converting the route to the java dsl



<camel:errorHandler id="smsReceivingErrorHandler" type="DeadLetterChannel"
deadLetterUri="smsReceivingDLQueue">
    <camel:redeliveryPolicy maximumRedeliveries="0" logStackTrace="true"
logHandled="false"/>
</camel:errorHandler>


<camel:route id="smsReceivingRoute" autoStartup="false"
errorHandlerRef="smsReceivingErrorHandler">
    <camel:from ref="smscReceiving"/>
    <camel:to ref="smsProcessing"/>
</camel:route>





--
View this message in context: http://camel.465427.n5.nabble.com/SMPP-stop-route-problem-tp5729769p5729903.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: SMPP stop route problem

Posted by Christian Müller <ch...@gmail.com>.
In the SMPP specification, the error code '0x000000FF' (which is 255) is
documented as "Unknow error". It doesn't look wrong to me.
If you want to return another error code, simply catch the exception in
your route and rethrow an org.jsmpp.extra.ProcessRequestException (with the
error code you want) which is returned to the SMSC.

Sounds right?

In general Camel will first stop the consumer on a route (from smpp://...)
so that you will not receive further requests. By default, Camel will shut
down gracefully [1].
Do you need more than 5 minutes to shut down? In this case (you should
really think about your architecture), it could be happen that you do not
ack the message because Camel forced the shut down. But in this case I
would expect the SMSC should resend the message.

[1] http://camel.apache.org/graceful-shutdown.html

Best,
Christian

On Tue, Mar 26, 2013 at 2:11 PM, fclose <fr...@closebase.com> wrote:

> I'll looked in the code and the only place I found that an error code could
> be generated is in
>
> org.apache.camel.component.smpp.MessageReceiverListenerImpl   line 105
>
> this seems to send back to the smsc an error 255, which is unkown to the
> smsc.
>
>
> I'll try to confirm that the error is really happening in
> MessageReceiverListenerImpl.onAcceptDataSm()
> If this is the case, does it mean, that there's a problem when we still
> receive messages and the route is in the process of stopping itself ?
>
>
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/SMPP-stop-route-problem-tp5729769p5729848.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: SMPP stop route problem

Posted by fclose <fr...@closebase.com>.
I'll looked in the code and the only place I found that an error code could
be generated is in 

org.apache.camel.component.smpp.MessageReceiverListenerImpl   line 105

this seems to send back to the smsc an error 255, which is unkown to the
smsc.


I'll try to confirm that the error is really happening in
MessageReceiverListenerImpl.onAcceptDataSm()
If this is the case, does it mean, that there's a problem when we still
receive messages and the route is in the process of stopping itself ? 







--
View this message in context: http://camel.465427.n5.nabble.com/SMPP-stop-route-problem-tp5729769p5729848.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: SMPP stop route problem

Posted by fclose <fr...@closebase.com>.
my route looks like this : 

<camel:endpoint id="smscReceiving"
uri="smpp://${smpp.user}@${smpp.server}?password=${smpp.password} ... "/>

<camel:route id="smsReceivingRoute" autoStartup="false"
errorHandlerRef="smsReceivingErrorHandler">
    <camel:from ref="smscReceiving"/>
    <camel:to ref="smsProcessing"/>
</camel:route>


I put logging on trace when I call context.stopRoute(rid);

and this is what I get 

DEBUG There are 1 routes to shutdown
TRACE Shutting down route: smsReceivingRoute with options
[Default,CompleteCurrentTaskOnly]
TRACE Suspending: SmppConsumer[smpp://*******************]
TRACE Suspend complete for: SmppConsumer[smpp://**************]
DEBUG Route: smsReceivingRoute suspended and shutdown deferred, was
consuming from: Endpoint[smpp://***************]
TRACE Shutting down: SmppConsumer[smpp://********************]
DEBUG Disconnecting from: smpp://********************...
DEBUG Stopping consumer: SmppConsumer[smpp://********************]
DEBUG Activity notified
INFO  PDUReaderWorker stop
DEBUG unbind response received
INFO  Disconnected from: smpp://********************
TRACE Shutdown complete for: SmppConsumer[smpp://********************]
INFO  Route: smsReceivingRoute shutdown complete, was consuming from:
Endpoint[smpp://********************]
INFO  Graceful shutdown of 1 routes completed in 1 seconds
INFO  Route: smsReceivingRoute is stopped, was consuming from:
Endpoint[smpp://********************]
INFO  Status Started waiting for stopped.
INFO  EnquireLinkSender stop











      



--
View this message in context: http://camel.465427.n5.nabble.com/SMPP-stop-route-problem-tp5729769p5729799.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: SMPP stop route problem

Posted by Chris Wolf <cw...@gmail.com>.
I don't know what your overall route looks like, but I think you will
need to tell an upstream messaging component to stop accepting new
messages, first, before calling context.stopRoute(rid) and also
configure the shutdown strategy to allow sufficient time
to process what was already in the queue:

ShutdownStrategy sds = context.getShutdownStrategy();
sds.setTimeout(120); //<== 2 minutes

On Mon, Mar 25, 2013 at 11:14 AM, fclose <fr...@closebase.com> wrote:
> Hello,
>
>
> like I explained in a previous post I'm looking for recommendations about
> how to stop a route listening for sms messages.
>
> Currently I'm stopping the route using the camel context
>
> camelContext.stopRoute(routeId);
>
> But doing so I'm losing some messages :
> Here is the description of the problem from the guys at smsc side :
>
> My application returns an error code FF (Hex) or 255 (Dec) before unbinding.
> Then SMSc will mark the message as an “invalid” and all next messages which
> will be sent  towards the same destination MSISDN will be put automatically
> to “undeliverable” and no delivery attempt will be made until the
> application connects again and starts accepting messages again for this
> destination MSISDN.
>
> As error code FF or 255 is not according the SMPP specifications, the SMSc
> will consider it as a permanent error (241).
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/SMPP-stop-route-problem-tp5729769.html
> Sent from the Camel - Users mailing list archive at Nabble.com.