You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by chudak <me...@gmail.com> on 2012/10/03 22:29:13 UTC

Problem with SMPP Consumer error handling

I'm following the SMPP documentation and trying to setup a consumer route. I
have my route talking to the Logica simulator and am trying to configure the
exception handling as discussed in the documentation. It seems that none of
the ways I've tried to configure the route are working correctly.

My current routebuilder looks like this:

 from(inboundSmppUri)
        .doTry()
          .to(inboundTargetUri)
        .doCatch(NullPointerException.class)
          .throwException(new ProcessRequestException("update of sms state
failed", 100))
        .doCatch(Throwable.class)
          .throwException(new ProcessRequestException("update of sms state
failed", 100))
        .end();

Where SMPP uri looks like this:

smpp://pavel@localhost:1717?password=wpsd&amp;enquireLinkTimer=5000&amp;transactionTimer=5000&amp;systemType=consumer

And the target URI looks like this:

activemqnontx:queue:inbound-sms

I have a broken transaction configuration on my jms configuration so the
message processing is failing:

2012-10-03 13:09:59,934 DEBUG [pool-1-thread-1]
[AbstractSessionContext.java:82] Activity notified
2012-10-03 13:09:59,937 DEBUG [pool-1-thread-1]
[MessageReceiverListenerImpl.java:65] Received a deliverSm PDUHeader(40,
00000005, 00000000, 15)
2012-10-03 13:09:59,960 DEBUG [pool-1-thread-1] [SendProcessor.java:114]
>>>> Endpoint[activemqnontx://queue:sms-inbound] Exchange[SmppMessage:
PDUHeader(40, 00000005, 00000000, 15)]
2012-10-03 13:09:59,970 INFO  [pool-1-thread-1]
[SingleConnectionFactory.java:291] Established shared JMS Connection:
com.atomikos.jms.JtaQueueConnection@ccd09b
2012-10-03 13:09:59,978 DEBUG [pool-1-thread-1] [JmsTemplate.java:464]
Executing callback on JMS Session: com.atomikos.jms.JtaQueueSession@1f613c
2012-10-03 13:10:00,026 DEBUG [pool-1-thread-1] [JmsConfiguration.java:266]
Sending JMS message to: queue://sms-inbound with message:
ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId =
null, originalDestination = null, originalTransactionId = null, producerId =
null, destination = null, transactionId = null, expiration = 0, timestamp =
0, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null,
replyTo = null, persistent = true, type = null, priority = 0, groupID =
null, groupSequence = 0, targetConsumerId = null, compressed = false, userID
= null, content = null, marshalledProperties = null, dataStructure = null,
redeliveryCounter = 0, size = 0, properties = {CamelSmppSequenceNumber=15,
breadcrumbId=ID-chudak-laptop2-59053-1349294879289-0-2,
CamelSmppCommandId=5, CamelSmppMessageType=DeliverSm}, readOnlyProperties =
false, readOnlyBody = false, droppable = false, text = 2314234}
2012-10-03 13:10:00,030 DEBUG [pool-1-thread-1] [TryProcessor.java:361] The
exception is handled: true for the exception:
org.springframework.jms.UncategorizedJmsException caused by: Uncategorized
exception occured during JMS processing; nested exception is
javax.jms.JMSException: JTA transaction required for JtaMessageProducer
2012-10-03 13:10:00,032 DEBUG [pool-1-thread-1] [SMPPSession.java:499]
deliver_sm_resp with seq_number 15 has been sent

However, the response being sent to the simulator shows no errors:

> 01:10:00 [pavel] client response: (deliver_resp: (pdu: 17 80000005 0 15) 
> ) 

Does anyone know what I have to do to get this exception propagated up to
the JSMPP library so it returns an error to the SMSC? This is not working as
advertised...





--
View this message in context: http://camel.465427.n5.nabble.com/Problem-with-SMPP-Consumer-error-handling-tp5720516.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Problem with SMPP Consumer error handling

Posted by Claus Ibsen <cl...@gmail.com>.
Btw I logged a ticket about this
https://issues.apache.org/jira/browse/CAMEL-5693

On Fri, Oct 5, 2012 at 1:15 PM, Claus Ibsen <cl...@gmail.com> wrote:
> On Thu, Oct 4, 2012 at 9:27 PM, Christian Müller
> <ch...@gmail.com> wrote:
>> @Claus: Could this be related to the doTry()/doCatch() issue you are
>> investigating at present? Or is the exception, which is thrown in the
>> doCatch() clause, wrapped into another exception?
>>
>>     public void onAcceptDeliverSm(DeliverSm deliverSm) throws
>> ProcessRequestException {
>>         LOG.debug("Received a deliverSm {}", deliverSm);
>>
>>         try {
>>             Exchange exchange =
>> endpoint.createOnAcceptDeliverSmExchange(deliverSm);
>>
>>             LOG.trace("processing the new smpp exchange...");
>>             processor.process(exchange);
>>             LOG.trace("processed the new smpp exchange");
>>         } catch (Exception e) {
>>             exceptionHandler.handleException(e);
>>             if (e instanceof ProcessRequestException) {
>>                 throw (ProcessRequestException) e;
>>             }
>>         }
>>     }
>
> The code above seems wrong.
>
> Is the idea to propagate back the exception by throwing the
> ProcessRequestException which is in the method signature?
>
> Then it should be something like
>
> try {
>   .. process
> } catch (Exception e) {
>   // notice this is unlikely to happen as the routing engine deals
> with the exceptions normally
>  // but we have it as a fail-safe just in case
>   exchange.setException(e);
> }
>
> if (exchange.getException() != null) {
>   // okay the processing failed
>   throw new ProcessRequestException("Error processing message",
> exchange.getException());
> }
>
>
>
>
>
>
>
>>
>> Best,
>> Christian
>>
>> On Wed, Oct 3, 2012 at 10:29 PM, chudak <me...@gmail.com> wrote:
>>
>>> I'm following the SMPP documentation and trying to setup a consumer route.
>>> I
>>> have my route talking to the Logica simulator and am trying to configure
>>> the
>>> exception handling as discussed in the documentation. It seems that none of
>>> the ways I've tried to configure the route are working correctly.
>>>
>>> My current routebuilder looks like this:
>>>
>>>  from(inboundSmppUri)
>>>         .doTry()
>>>           .to(inboundTargetUri)
>>>         .doCatch(NullPointerException.class)
>>>           .throwException(new ProcessRequestException("update of sms state
>>> failed", 100))
>>>         .doCatch(Throwable.class)
>>>           .throwException(new ProcessRequestException("update of sms state
>>> failed", 100))
>>>         .end();
>>>
>>> Where SMPP uri looks like this:
>>>
>>> smpp://pavel@localhost
>>> :1717?password=wpsd&amp;enquireLinkTimer=5000&amp;transactionTimer=5000&amp;systemType=consumer
>>>
>>> And the target URI looks like this:
>>>
>>> activemqnontx:queue:inbound-sms
>>>
>>> I have a broken transaction configuration on my jms configuration so the
>>> message processing is failing:
>>>
>>> 2012-10-03 13:09:59,934 DEBUG [pool-1-thread-1]
>>> [AbstractSessionContext.java:82] Activity notified
>>> 2012-10-03 13:09:59,937 DEBUG [pool-1-thread-1]
>>> [MessageReceiverListenerImpl.java:65] Received a deliverSm PDUHeader(40,
>>> 00000005, 00000000, 15)
>>> 2012-10-03 13:09:59,960 DEBUG [pool-1-thread-1] [SendProcessor.java:114]
>>> >>>> Endpoint[activemqnontx://queue:sms-inbound] Exchange[SmppMessage:
>>> PDUHeader(40, 00000005, 00000000, 15)]
>>> 2012-10-03 13:09:59,970 INFO  [pool-1-thread-1]
>>> [SingleConnectionFactory.java:291] Established shared JMS Connection:
>>> com.atomikos.jms.JtaQueueConnection@ccd09b
>>> 2012-10-03 13:09:59,978 DEBUG [pool-1-thread-1] [JmsTemplate.java:464]
>>> Executing callback on JMS Session: com.atomikos.jms.JtaQueueSession@1f613c
>>> 2012-10-03 13:10:00,026 DEBUG [pool-1-thread-1] [JmsConfiguration.java:266]
>>> Sending JMS message to: queue://sms-inbound with message:
>>> ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId =
>>> null, originalDestination = null, originalTransactionId = null, producerId
>>> =
>>> null, destination = null, transactionId = null, expiration = 0, timestamp =
>>> 0, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null,
>>> replyTo = null, persistent = true, type = null, priority = 0, groupID =
>>> null, groupSequence = 0, targetConsumerId = null, compressed = false,
>>> userID
>>> = null, content = null, marshalledProperties = null, dataStructure = null,
>>> redeliveryCounter = 0, size = 0, properties = {CamelSmppSequenceNumber=15,
>>> breadcrumbId=ID-chudak-laptop2-59053-1349294879289-0-2,
>>> CamelSmppCommandId=5, CamelSmppMessageType=DeliverSm}, readOnlyProperties =
>>> false, readOnlyBody = false, droppable = false, text = 2314234}
>>> 2012-10-03 13:10:00,030 DEBUG [pool-1-thread-1] [TryProcessor.java:361] The
>>> exception is handled: true for the exception:
>>> org.springframework.jms.UncategorizedJmsException caused by: Uncategorized
>>> exception occured during JMS processing; nested exception is
>>> javax.jms.JMSException: JTA transaction required for JtaMessageProducer
>>> 2012-10-03 13:10:00,032 DEBUG [pool-1-thread-1] [SMPPSession.java:499]
>>> deliver_sm_resp with seq_number 15 has been sent
>>>
>>> However, the response being sent to the simulator shows no errors:
>>>
>>> > 01:10:00 [pavel] client response: (deliver_resp: (pdu: 17 80000005 0 15)
>>> > )
>>>
>>> Does anyone know what I have to do to get this exception propagated up to
>>> the JSMPP library so it returns an error to the SMSC? This is not working
>>> as
>>> advertised...
>>>
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://camel.465427.n5.nabble.com/Problem-with-SMPP-Consumer-error-handling-tp5720516.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>
>>
>>
>> --
>
>
>
> --
> 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



-- 
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: Problem with SMPP Consumer error handling

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Oct 4, 2012 at 9:27 PM, Christian Müller
<ch...@gmail.com> wrote:
> @Claus: Could this be related to the doTry()/doCatch() issue you are
> investigating at present? Or is the exception, which is thrown in the
> doCatch() clause, wrapped into another exception?
>
>     public void onAcceptDeliverSm(DeliverSm deliverSm) throws
> ProcessRequestException {
>         LOG.debug("Received a deliverSm {}", deliverSm);
>
>         try {
>             Exchange exchange =
> endpoint.createOnAcceptDeliverSmExchange(deliverSm);
>
>             LOG.trace("processing the new smpp exchange...");
>             processor.process(exchange);
>             LOG.trace("processed the new smpp exchange");
>         } catch (Exception e) {
>             exceptionHandler.handleException(e);
>             if (e instanceof ProcessRequestException) {
>                 throw (ProcessRequestException) e;
>             }
>         }
>     }

The code above seems wrong.

Is the idea to propagate back the exception by throwing the
ProcessRequestException which is in the method signature?

Then it should be something like

try {
  .. process
} catch (Exception e) {
  // notice this is unlikely to happen as the routing engine deals
with the exceptions normally
 // but we have it as a fail-safe just in case
  exchange.setException(e);
}

if (exchange.getException() != null) {
  // okay the processing failed
  throw new ProcessRequestException("Error processing message",
exchange.getException());
}







>
> Best,
> Christian
>
> On Wed, Oct 3, 2012 at 10:29 PM, chudak <me...@gmail.com> wrote:
>
>> I'm following the SMPP documentation and trying to setup a consumer route.
>> I
>> have my route talking to the Logica simulator and am trying to configure
>> the
>> exception handling as discussed in the documentation. It seems that none of
>> the ways I've tried to configure the route are working correctly.
>>
>> My current routebuilder looks like this:
>>
>>  from(inboundSmppUri)
>>         .doTry()
>>           .to(inboundTargetUri)
>>         .doCatch(NullPointerException.class)
>>           .throwException(new ProcessRequestException("update of sms state
>> failed", 100))
>>         .doCatch(Throwable.class)
>>           .throwException(new ProcessRequestException("update of sms state
>> failed", 100))
>>         .end();
>>
>> Where SMPP uri looks like this:
>>
>> smpp://pavel@localhost
>> :1717?password=wpsd&amp;enquireLinkTimer=5000&amp;transactionTimer=5000&amp;systemType=consumer
>>
>> And the target URI looks like this:
>>
>> activemqnontx:queue:inbound-sms
>>
>> I have a broken transaction configuration on my jms configuration so the
>> message processing is failing:
>>
>> 2012-10-03 13:09:59,934 DEBUG [pool-1-thread-1]
>> [AbstractSessionContext.java:82] Activity notified
>> 2012-10-03 13:09:59,937 DEBUG [pool-1-thread-1]
>> [MessageReceiverListenerImpl.java:65] Received a deliverSm PDUHeader(40,
>> 00000005, 00000000, 15)
>> 2012-10-03 13:09:59,960 DEBUG [pool-1-thread-1] [SendProcessor.java:114]
>> >>>> Endpoint[activemqnontx://queue:sms-inbound] Exchange[SmppMessage:
>> PDUHeader(40, 00000005, 00000000, 15)]
>> 2012-10-03 13:09:59,970 INFO  [pool-1-thread-1]
>> [SingleConnectionFactory.java:291] Established shared JMS Connection:
>> com.atomikos.jms.JtaQueueConnection@ccd09b
>> 2012-10-03 13:09:59,978 DEBUG [pool-1-thread-1] [JmsTemplate.java:464]
>> Executing callback on JMS Session: com.atomikos.jms.JtaQueueSession@1f613c
>> 2012-10-03 13:10:00,026 DEBUG [pool-1-thread-1] [JmsConfiguration.java:266]
>> Sending JMS message to: queue://sms-inbound with message:
>> ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId =
>> null, originalDestination = null, originalTransactionId = null, producerId
>> =
>> null, destination = null, transactionId = null, expiration = 0, timestamp =
>> 0, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null,
>> replyTo = null, persistent = true, type = null, priority = 0, groupID =
>> null, groupSequence = 0, targetConsumerId = null, compressed = false,
>> userID
>> = null, content = null, marshalledProperties = null, dataStructure = null,
>> redeliveryCounter = 0, size = 0, properties = {CamelSmppSequenceNumber=15,
>> breadcrumbId=ID-chudak-laptop2-59053-1349294879289-0-2,
>> CamelSmppCommandId=5, CamelSmppMessageType=DeliverSm}, readOnlyProperties =
>> false, readOnlyBody = false, droppable = false, text = 2314234}
>> 2012-10-03 13:10:00,030 DEBUG [pool-1-thread-1] [TryProcessor.java:361] The
>> exception is handled: true for the exception:
>> org.springframework.jms.UncategorizedJmsException caused by: Uncategorized
>> exception occured during JMS processing; nested exception is
>> javax.jms.JMSException: JTA transaction required for JtaMessageProducer
>> 2012-10-03 13:10:00,032 DEBUG [pool-1-thread-1] [SMPPSession.java:499]
>> deliver_sm_resp with seq_number 15 has been sent
>>
>> However, the response being sent to the simulator shows no errors:
>>
>> > 01:10:00 [pavel] client response: (deliver_resp: (pdu: 17 80000005 0 15)
>> > )
>>
>> Does anyone know what I have to do to get this exception propagated up to
>> the JSMPP library so it returns an error to the SMSC? This is not working
>> as
>> advertised...
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Problem-with-SMPP-Consumer-error-handling-tp5720516.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>
>
> --



-- 
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: Problem with SMPP Consumer error handling

Posted by Christian Müller <ch...@gmail.com>.
@Claus: Could this be related to the doTry()/doCatch() issue you are
investigating at present? Or is the exception, which is thrown in the
doCatch() clause, wrapped into another exception?

    public void onAcceptDeliverSm(DeliverSm deliverSm) throws
ProcessRequestException {
        LOG.debug("Received a deliverSm {}", deliverSm);

        try {
            Exchange exchange =
endpoint.createOnAcceptDeliverSmExchange(deliverSm);

            LOG.trace("processing the new smpp exchange...");
            processor.process(exchange);
            LOG.trace("processed the new smpp exchange");
        } catch (Exception e) {
            exceptionHandler.handleException(e);
            if (e instanceof ProcessRequestException) {
                throw (ProcessRequestException) e;
            }
        }
    }

Best,
Christian

On Wed, Oct 3, 2012 at 10:29 PM, chudak <me...@gmail.com> wrote:

> I'm following the SMPP documentation and trying to setup a consumer route.
> I
> have my route talking to the Logica simulator and am trying to configure
> the
> exception handling as discussed in the documentation. It seems that none of
> the ways I've tried to configure the route are working correctly.
>
> My current routebuilder looks like this:
>
>  from(inboundSmppUri)
>         .doTry()
>           .to(inboundTargetUri)
>         .doCatch(NullPointerException.class)
>           .throwException(new ProcessRequestException("update of sms state
> failed", 100))
>         .doCatch(Throwable.class)
>           .throwException(new ProcessRequestException("update of sms state
> failed", 100))
>         .end();
>
> Where SMPP uri looks like this:
>
> smpp://pavel@localhost
> :1717?password=wpsd&amp;enquireLinkTimer=5000&amp;transactionTimer=5000&amp;systemType=consumer
>
> And the target URI looks like this:
>
> activemqnontx:queue:inbound-sms
>
> I have a broken transaction configuration on my jms configuration so the
> message processing is failing:
>
> 2012-10-03 13:09:59,934 DEBUG [pool-1-thread-1]
> [AbstractSessionContext.java:82] Activity notified
> 2012-10-03 13:09:59,937 DEBUG [pool-1-thread-1]
> [MessageReceiverListenerImpl.java:65] Received a deliverSm PDUHeader(40,
> 00000005, 00000000, 15)
> 2012-10-03 13:09:59,960 DEBUG [pool-1-thread-1] [SendProcessor.java:114]
> >>>> Endpoint[activemqnontx://queue:sms-inbound] Exchange[SmppMessage:
> PDUHeader(40, 00000005, 00000000, 15)]
> 2012-10-03 13:09:59,970 INFO  [pool-1-thread-1]
> [SingleConnectionFactory.java:291] Established shared JMS Connection:
> com.atomikos.jms.JtaQueueConnection@ccd09b
> 2012-10-03 13:09:59,978 DEBUG [pool-1-thread-1] [JmsTemplate.java:464]
> Executing callback on JMS Session: com.atomikos.jms.JtaQueueSession@1f613c
> 2012-10-03 13:10:00,026 DEBUG [pool-1-thread-1] [JmsConfiguration.java:266]
> Sending JMS message to: queue://sms-inbound with message:
> ActiveMQTextMessage {commandId = 0, responseRequired = false, messageId =
> null, originalDestination = null, originalTransactionId = null, producerId
> =
> null, destination = null, transactionId = null, expiration = 0, timestamp =
> 0, arrival = 0, brokerInTime = 0, brokerOutTime = 0, correlationId = null,
> replyTo = null, persistent = true, type = null, priority = 0, groupID =
> null, groupSequence = 0, targetConsumerId = null, compressed = false,
> userID
> = null, content = null, marshalledProperties = null, dataStructure = null,
> redeliveryCounter = 0, size = 0, properties = {CamelSmppSequenceNumber=15,
> breadcrumbId=ID-chudak-laptop2-59053-1349294879289-0-2,
> CamelSmppCommandId=5, CamelSmppMessageType=DeliverSm}, readOnlyProperties =
> false, readOnlyBody = false, droppable = false, text = 2314234}
> 2012-10-03 13:10:00,030 DEBUG [pool-1-thread-1] [TryProcessor.java:361] The
> exception is handled: true for the exception:
> org.springframework.jms.UncategorizedJmsException caused by: Uncategorized
> exception occured during JMS processing; nested exception is
> javax.jms.JMSException: JTA transaction required for JtaMessageProducer
> 2012-10-03 13:10:00,032 DEBUG [pool-1-thread-1] [SMPPSession.java:499]
> deliver_sm_resp with seq_number 15 has been sent
>
> However, the response being sent to the simulator shows no errors:
>
> > 01:10:00 [pavel] client response: (deliver_resp: (pdu: 17 80000005 0 15)
> > )
>
> Does anyone know what I have to do to get this exception propagated up to
> the JSMPP library so it returns an error to the SMSC? This is not working
> as
> advertised...
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Problem-with-SMPP-Consumer-error-handling-tp5720516.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



--