Skip to content

Commit 5ee2a77

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

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
@@ -474,6 +474,19 @@ public Map<String, BlockingCell<Object>> getContinuationMap() {
474474
return _continuationMap;
475475
}
476476

477+
/**
478+
* Retrieve the correlation id.
479+
* @return the most recently used correlation id
480+
* @deprecated Only works for {@link IncrementingCorrelationIdGenerator}
481+
*/
482+
public int getCorrelationId() {
483+
if (_correlationIdGenerator instanceof IncrementingCorrelationIdGenerator) {
484+
return ((IncrementingCorrelationIdGenerator) _correlationIdGenerator).getCorrelationId();
485+
} else {
486+
throw new UnsupportedOperationException();
487+
}
488+
}
489+
477490
/**
478491
* Retrieve the consumer.
479492
* @return an interface to the client's consumer object

0 commit comments

Comments
 (0)