Skip to content

Commit a264044

Browse files
janssk1acogoluegnes
janssk1
authored andcommitted
637: Default generator should not be static
Change-Id: Ib1f90d5a25f1c5db32ff9c838cfbeb35aac5d671 (cherry picked from commit 59e9455)
1 parent edf25f6 commit a264044

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
@@ -481,6 +481,19 @@ public Map<String, BlockingCell<Object>> getContinuationMap() {
481481
return _continuationMap;
482482
}
483483

484+
/**
485+
* Retrieve the correlation id.
486+
* @return the most recently used correlation id
487+
* @deprecated Only works for {@link IncrementingCorrelationIdGenerator}
488+
*/
489+
public int getCorrelationId() {
490+
if (_correlationIdGenerator instanceof IncrementingCorrelationIdGenerator) {
491+
return ((IncrementingCorrelationIdGenerator) _correlationIdGenerator).getCorrelationId();
492+
} else {
493+
throw new UnsupportedOperationException();
494+
}
495+
}
496+
484497
/**
485498
* Retrieve the consumer.
486499
* @return an interface to the client's consumer object

0 commit comments

Comments
 (0)