camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmuel...@apache.org
Subject svn commit: r1073182 - /camel/trunk/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppProducer.java
Date Mon, 21 Feb 2011 23:10:05 GMT
Author: cmueller
Date: Mon Feb 21 23:10:05 2011
New Revision: 1073182

URL: http://svn.apache.org/viewvc?rev=1073182&view=rev
Log:
revert my last faulty commit

Modified:
    camel/trunk/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppProducer.java

Modified: camel/trunk/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppProducer.java?rev=1073182&r1=1073181&r2=1073182&view=diff
==============================================================================
--- camel/trunk/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppProducer.java
(original)
+++ camel/trunk/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppProducer.java
Mon Feb 21 23:10:05 2011
@@ -17,12 +17,9 @@
 package org.apache.camel.component.smpp;
 
 import java.io.IOException;
-import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.locks.ReentrantLock;
 
-import org.apache.camel.AsyncCallback;
 import org.apache.camel.Exchange;
-import org.apache.camel.impl.DefaultAsyncProducer;
 import org.apache.camel.impl.DefaultProducer;
 import org.jsmpp.DefaultPDUReader;
 import org.jsmpp.DefaultPDUSender;
@@ -50,7 +47,7 @@ import org.slf4j.LoggerFactory;
  * @version 
  * @author muellerc
  */
-public class SmppProducer extends DefaultAsyncProducer {
+public class SmppProducer extends DefaultProducer {
 
     private static final transient Logger LOG = LoggerFactory.getLogger(SmppProducer.class);
 
@@ -117,58 +114,40 @@ public class SmppProducer extends Defaul
         }
     }
 
-    public boolean process(Exchange exchange, AsyncCallback callback) {
+    public void process(Exchange exchange) throws Exception {
         if (LOG.isDebugEnabled()) {
             LOG.debug("Sending a short message for exchange id '"
                     + exchange.getExchangeId() + "'...");
         }
         
-        if (!isRunAllowed()) {
-            if (exchange.getException() == null) {
-                exchange.setException(new RejectedExecutionException());
-            }
-            callback.done(true);
-            return true;
-        }
-        
         // only possible by trying to reconnect 
         if (this.session == null) {
-            exchange.setException(new IOException("Lost connection to " + getEndpoint().getConnectionString()
+ " and yet not reconnected"));
-            callback.done(true);
-            return true;
+            throw new IOException("Lost connection to " + getEndpoint().getConnectionString()
+ " and yet not reconnected");
         }
 
-        SubmitSm submitSm = null;
-        String messageId = null;
-        try {
-            submitSm = getEndpoint().getBinding().createSubmitSm(exchange);
-            messageId = session.submitShortMessage(
-                    submitSm.getServiceType(), 
-                    TypeOfNumber.valueOf(submitSm.getSourceAddrTon()),
-                    NumberingPlanIndicator.valueOf(submitSm.getSourceAddrNpi()),
-                    submitSm.getSourceAddr(),
-                    TypeOfNumber.valueOf(submitSm.getDestAddrTon()),
-                    NumberingPlanIndicator.valueOf(submitSm.getDestAddrNpi()),
-                    submitSm.getDestAddress(),
-                    new ESMClass(),
-                    submitSm.getProtocolId(),
-                    submitSm.getPriorityFlag(),
-                    submitSm.getScheduleDeliveryTime(),
-                    submitSm.getValidityPeriod(),
-                    new RegisteredDelivery(submitSm.getRegisteredDelivery()),
-                    submitSm.getReplaceIfPresent(),
-                    new GeneralDataCoding(
-                            false,
-                            false,
-                            MessageClass.CLASS1,
-                            Alphabet.valueOf(submitSm.getDataCoding())),
-                    (byte) 0,
-                    submitSm.getShortMessage());
-        } catch (Exception e) {
-            exchange.setException(e);
-            callback.done(true);
-            return true;
-        }
+        SubmitSm submitSm = getEndpoint().getBinding().createSubmitSm(exchange);
+        String messageId = session.submitShortMessage(
+                submitSm.getServiceType(), 
+                TypeOfNumber.valueOf(submitSm.getSourceAddrTon()),
+                NumberingPlanIndicator.valueOf(submitSm.getSourceAddrNpi()),
+                submitSm.getSourceAddr(),
+                TypeOfNumber.valueOf(submitSm.getDestAddrTon()),
+                NumberingPlanIndicator.valueOf(submitSm.getDestAddrNpi()),
+                submitSm.getDestAddress(),
+                new ESMClass(),
+                submitSm.getProtocolId(),
+                submitSm.getPriorityFlag(),
+                submitSm.getScheduleDeliveryTime(),
+                submitSm.getValidityPeriod(),
+                new RegisteredDelivery(submitSm.getRegisteredDelivery()),
+                submitSm.getReplaceIfPresent(),
+                new GeneralDataCoding(
+                        false,
+                        false,
+                        MessageClass.CLASS1,
+                        Alphabet.valueOf(submitSm.getDataCoding())),
+                (byte) 0,
+                submitSm.getShortMessage());
 
         if (LOG.isDebugEnabled()) {
             LOG.debug("Sent a short message for exchange id '"
@@ -187,9 +166,6 @@ public class SmppProducer extends Defaul
             }
             exchange.getIn().setHeader(SmppBinding.ID, messageId);
         }
-        
-        // continue routing asynchronously
-        return false;
     }
 
     @Override



Mime
View raw message