|
33 | 33 | import com.rabbitmq.client.impl.ValueReader; |
34 | 34 | import com.rabbitmq.client.impl.ValueWriter; |
35 | 35 | import com.rabbitmq.utility.BlockingCell; |
| 36 | +import org.slf4j.Logger; |
| 37 | +import org.slf4j.LoggerFactory; |
36 | 38 |
|
37 | 39 | /** |
38 | 40 | * Convenience class which manages simple RPC-style communication. |
|
41 | 43 | * and waiting for a response. |
42 | 44 | */ |
43 | 45 | public class RpcClient { |
| 46 | + |
| 47 | + private static final Logger LOGGER = LoggerFactory.getLogger(RpcClient.class); |
| 48 | + |
44 | 49 | /** Channel we are communicating on */ |
45 | 50 | private final Channel _channel; |
46 | 51 | /** Exchange to send requests to */ |
@@ -191,10 +196,12 @@ public void handleDelivery(String consumerTag, |
191 | 196 | synchronized (_continuationMap) { |
192 | 197 | String replyId = properties.getCorrelationId(); |
193 | 198 | BlockingCell<Object> blocker =_continuationMap.remove(replyId); |
194 | | - if (blocker != null) { |
195 | | - blocker.set(new Response(consumerTag, envelope, properties, body)); |
| 199 | + if (blocker == null) { |
| 200 | + // Entry should have been removed if request timed out, |
| 201 | + // log a warning nevertheless. |
| 202 | + LOGGER.warn("No outstanding request for correlation ID {}", replyId); |
196 | 203 | } else { |
197 | | - // Not an error. Entry will have been removed if request timed out. |
| 204 | + blocker.set(new Response(consumerTag, envelope, properties, body)); |
198 | 205 | } |
199 | 206 | } |
200 | 207 | } |
|
0 commit comments