You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ra...@apache.org on 2013/10/10 21:35:16 UTC
[3/3] git commit: Construct a ConsumerId from a String
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 <ra...@gmail.com>
Authored: Thu Oct 10 17:31:23 2013 +0100
Committer: rajdavies <ra...@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();