activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject [3/3] git commit: Construct a ConsumerId from a String
Date Thu, 10 Oct 2013 19:35:16 GMT
Construct a ConsumerId from a String


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

Branch: refs/heads/trunk
Commit: ccb119d896620c4c44bc0e341496efc4b519b59f
Parents: e90ce1a
Author: rajdavies <rajdavies@gmail.com>
Authored: Thu Oct 10 17:31:23 2013 +0100
Committer: rajdavies <rajdavies@gmail.com>
Committed: Thu Oct 10 20:30:01 2013 +0100

----------------------------------------------------------------------
 .../java/org/apache/activemq/command/ConsumerId.java     | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/ccb119d8/activemq-client/src/main/java/org/apache/activemq/command/ConsumerId.java
----------------------------------------------------------------------
diff --git a/activemq-client/src/main/java/org/apache/activemq/command/ConsumerId.java b/activemq-client/src/main/java/org/apache/activemq/command/ConsumerId.java
index e955763..29a42ee 100755
--- a/activemq-client/src/main/java/org/apache/activemq/command/ConsumerId.java
+++ b/activemq-client/src/main/java/org/apache/activemq/command/ConsumerId.java
@@ -35,6 +35,17 @@ public class ConsumerId implements DataStructure {
     public ConsumerId() {
     }
 
+    public ConsumerId(String str){
+        if (str != null){
+            String[] splits = str.split(":");
+            if (splits != null && splits.length >= 3){
+                this.connectionId = splits[0];
+                this.sessionId =  Long.parseLong(splits[1]);
+                this.value = Long.parseLong(splits[2]);
+            }
+        }
+    }
+
     public ConsumerId(SessionId sessionId, long consumerId) {
         this.connectionId = sessionId.getConnectionId();
         this.sessionId = sessionId.getValue();


Mime
View raw message