Skip to content

Commit 59e9455

Browse files
author
janssk1
committed
637: Default generator should not be static
Change-Id: Ib1f90d5a25f1c5db32ff9c838cfbeb35aac5d671
1 parent 102cbbd commit 59e9455

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/main/java/com/rabbitmq/client/IncrementingCorrelationIdGenerator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@ public IncrementingCorrelationIdGenerator(String _prefix) {
1515
public String get() {
1616
return _prefix + _correlationId++;
1717
}
18+
19+
public int getCorrelationId() {
20+
return _correlationId;
21+
}
1822
}

src/main/java/com/rabbitmq/client/RpcClient.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,19 @@ public Map<String, BlockingCell<Object>> getContinuationMap() {
389389
return _continuationMap;
390390
}
391391

392+
/**
393+
* Retrieve the correlation id.
394+
* @return the most recently used correlation id
395+
* @deprecated Only works for {@link IncrementingCorrelationIdGenerator}
396+
*/
397+
public int getCorrelationId() {
398+
if (_correlationIdGenerator instanceof IncrementingCorrelationIdGenerator) {
399+
return ((IncrementingCorrelationIdGenerator) _correlationIdGenerator).getCorrelationId();
400+
} else {
401+
throw new UnsupportedOperationException();
402+
}
403+
}
404+
392405
/**
393406
* Retrieve the consumer.
394407
* @return an interface to the client's consumer object

0 commit comments

Comments
 (0)