Construct a ConsumerId from a String

This commit is contained in:
rajdavies 2013-10-10 17:31:23 +01:00
parent e90ce1aabb
commit ccb119d896
1 changed files with 11 additions and 0 deletions

View File

@ -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();