You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/08/07 14:16:17 UTC

[2/2] camel git commit: Fixed CS. This closes #1113

Fixed CS. This closes #1113


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ebf97e38
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ebf97e38
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ebf97e38

Branch: refs/heads/master
Commit: ebf97e386ccb45e812aeeb05556d114fe76873d0
Parents: 43571f1
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Aug 7 16:14:07 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Aug 7 16:16:06 2016 +0200

----------------------------------------------------------------------
 components/camel-smpp/src/main/docs/smpp.adoc   |  5 ++-
 .../camel/component/smpp/SmppConfiguration.java | 33 ++++++++++----------
 .../camel/component/smpp/SmppConsumer.java      |  7 +++--
 .../camel/component/smpp/SmppProducer.java      |  7 +++--
 .../component/smpp/SmppConfigurationTest.java   |  1 +
 5 files changed, 29 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ebf97e38/components/camel-smpp/src/main/docs/smpp.adoc
----------------------------------------------------------------------
diff --git a/components/camel-smpp/src/main/docs/smpp.adoc b/components/camel-smpp/src/main/docs/smpp.adoc
index c2018da..72a8e1d 100644
--- a/components/camel-smpp/src/main/docs/smpp.adoc
+++ b/components/camel-smpp/src/main/docs/smpp.adoc
@@ -229,8 +229,9 @@ The SMPP component supports 36 options which are listed below.
 
 
 
+
 // endpoint options: START
-The SMPP component supports 39 endpoint options which are listed below:
+The SMPP component supports 40 endpoint options which are listed below:
 
 {% raw %}
 [width="100%",cols="2s,1,1m,1m,5",options="header"]
@@ -239,6 +240,7 @@ The SMPP component supports 39 endpoint options which are listed below:
 | host | common | localhost | String | Hostname for the SMSC server to use.
 | port | common | 2775 | Integer | Port number for the SMSC server to use.
 | initialReconnectDelay | common | 5000 | long | Defines the initial delay in milliseconds after the consumer/producer tries to reconnect to the SMSC after the connection was lost.
+| maxReconnect | common | 2147483647 | int | Defines the maximum number of attempts to reconnect to the SMSC if SMSC returns a negative bind response
 | reconnectDelay | common | 5000 | long | Defines the interval in milliseconds between the reconnect attempts if the connection to the SMSC was lost and the previous was not succeed.
 | splittingPolicy | common | ALLOW | SmppSplittingPolicy | You can specify a policy for handling long messages: ALLOW - the default long messages are split to 140 bytes per message TRUNCATE - long messages are split and only the first fragment will be sent to the SMSC. Some carriers drop subsequent fragments so this reduces load on the SMPP connection sending parts of a message that will never be delivered. REJECT - if a message would need to be split it is rejected with an SMPP NegativeResponseException and the reason code signifying the message is too long.
 | systemType | common | cp | String | This parameter is used to categorize the type of ESME (External Short Message Entity) that is binding to the SMSC (max. 13 characters).
@@ -280,6 +282,7 @@ The SMPP component supports 39 endpoint options which are listed below:
 // endpoint options: END
 
 
+
 You can have as many of these options as you like.
 
 [source,java]

http://git-wip-us.apache.org/repos/asf/camel/blob/ebf97e38/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConfiguration.java b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConfiguration.java
index e9d3af9..4cd2ff2 100644
--- a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConfiguration.java
+++ b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConfiguration.java
@@ -18,8 +18,8 @@ package org.apache.camel.component.smpp;
 
 import java.net.URI;
 import java.nio.charset.Charset;
-
 import java.util.Map;
+
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.spi.UriParam;
 import org.apache.camel.spi.UriParams;
@@ -98,7 +98,7 @@ public class SmppConfiguration implements Cloneable {
     private long reconnectDelay = 5000;
     @UriParam(label = "common", defaultValue = "2147483647")
     private int maxReconnect = Integer.MAX_VALUE;
-	@UriParam(label = "producer")
+    @UriParam(label = "producer")
     private boolean lazySessionCreation;
     @UriParam(label = "proxy")
     private String httpProxyHost;
@@ -532,30 +532,29 @@ public class SmppConfiguration implements Cloneable {
     public void setInitialReconnectDelay(long initialReconnectDelay) {
         this.initialReconnectDelay = initialReconnectDelay;
     }
-    
+
     public long getReconnectDelay() {
         return reconnectDelay;
     }
-    
+
     /**
      * Defines the interval in milliseconds between the reconnect attempts, if the connection to the SMSC was lost and the previous was not succeed.
      */
     public void setReconnectDelay(long reconnectDelay) {
         this.reconnectDelay = reconnectDelay;
     }
-    
+
     /**
-     * CAMEL-6616
      * Defines the maximum number of attempts to reconnect to the SMSC, if SMSC returns a negative bind response
      */
     public int getMaxReconnect() {
-		return maxReconnect;
-	}
+        return maxReconnect;
+    }
+
+    public void setMaxReconnect(int maxReconnect) {
+        this.maxReconnect = maxReconnect;
+    }
 
-	public void setMaxReconnect(int maxReconnect) {
-		this.maxReconnect = maxReconnect;
-	}
-    
     public boolean isLazySessionCreation() {
         return lazySessionCreation;
     }
@@ -568,7 +567,7 @@ public class SmppConfiguration implements Cloneable {
     public void setLazySessionCreation(boolean lazySessionCreation) {
         this.lazySessionCreation = lazySessionCreation;
     }
-    
+
     public String getHttpProxyHost() {
         return httpProxyHost;
     }
@@ -579,7 +578,7 @@ public class SmppConfiguration implements Cloneable {
     public void setHttpProxyHost(String httpProxyHost) {
         this.httpProxyHost = httpProxyHost;
     }
-    
+
     public Integer getHttpProxyPort() {
         return httpProxyPort;
     }
@@ -590,7 +589,7 @@ public class SmppConfiguration implements Cloneable {
     public void setHttpProxyPort(Integer httpProxyPort) {
         this.httpProxyPort = httpProxyPort;
     }
-    
+
     public String getHttpProxyUsername() {
         return httpProxyUsername;
     }
@@ -601,7 +600,7 @@ public class SmppConfiguration implements Cloneable {
     public void setHttpProxyUsername(String httpProxyUsername) {
         this.httpProxyUsername = httpProxyUsername;
     }
-    
+
     public String getHttpProxyPassword() {
         return httpProxyPassword;
     }
@@ -612,7 +611,7 @@ public class SmppConfiguration implements Cloneable {
     public void setHttpProxyPassword(String httpProxyPassword) {
         this.httpProxyPassword = httpProxyPassword;
     }
-    
+
     public SessionStateListener getSessionStateListener() {
         return sessionStateListener;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/ebf97e38/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConsumer.java b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConsumer.java
index 9cbd2bc..5c50a6f 100644
--- a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConsumer.java
+++ b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppConsumer.java
@@ -155,13 +155,14 @@ public class SmppConsumer extends DefaultConsumer {
 
                         int attempt = 0;
                         while (!(isStopping() || isStopped()) && (session == null || session.getSessionState().equals(SessionState.CLOSED))
-                        		&& attempt < configuration.getMaxReconnect()) {
+                                && attempt < configuration.getMaxReconnect()) {
                             try {
-                                LOG.info("Trying to reconnect to " + getEndpoint().getConnectionString() + " - attempt #" + (++attempt) + "...");
+                                attempt++;
+                                LOG.info("Trying to reconnect to {} - attempt #", getEndpoint().getConnectionString(), attempt);
                                 session = createSession();
                                 reconnected = true;
                             } catch (IOException e) {
-                                LOG.info("Failed to reconnect to " + getEndpoint().getConnectionString());
+                                LOG.warn("Failed to reconnect to {}", getEndpoint().getConnectionString());
                                 closeSession();
                                 try {
                                     Thread.sleep(configuration.getReconnectDelay());

http://git-wip-us.apache.org/repos/asf/camel/blob/ebf97e38/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppProducer.java b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppProducer.java
index 13935ce..048d5bc 100644
--- a/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppProducer.java
+++ b/components/camel-smpp/src/main/java/org/apache/camel/component/smpp/SmppProducer.java
@@ -190,13 +190,14 @@ public class SmppProducer extends DefaultProducer {
 
                         int attempt = 0;
                         while (!(isStopping() || isStopped()) && (session == null || session.getSessionState().equals(SessionState.CLOSED))
-                        		&& attempt < configuration.getMaxReconnect()) {
+                                && attempt < configuration.getMaxReconnect()) {
                             try {
-                                LOG.info("Trying to reconnect to " + getEndpoint().getConnectionString() + " - attempt #" + (++attempt) + "...");
+                                attempt++;
+                                LOG.info("Trying to reconnect to {} - attempt #", getEndpoint().getConnectionString(), attempt);
                                 session = createSession();
                                 reconnected = true;
                             } catch (IOException e) {
-                                LOG.info("Failed to reconnect to " + getEndpoint().getConnectionString());
+                                LOG.warn("Failed to reconnect to {}", getEndpoint().getConnectionString());
                                 closeSession();
                                 try {
                                     Thread.sleep(configuration.getReconnectDelay());

http://git-wip-us.apache.org/repos/asf/camel/blob/ebf97e38/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConfigurationTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConfigurationTest.java
index 3cb4b5e..223cb04 100644
--- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConfigurationTest.java
+++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppConfigurationTest.java
@@ -193,6 +193,7 @@ public class SmppConfigurationTest {
                 + "numberingPlanIndicator=0, "
                 + "initialReconnectDelay=5000, "
                 + "reconnectDelay=5000, "
+                + "maxReconnect=2147483647, "
                 + "lazySessionCreation=false, "
                 + "httpProxyHost=null, "
                 + "httpProxyPort=3128, "