41
41
import org .slf4j .Logger ;
42
42
import org .slf4j .LoggerFactory ;
43
43
44
+ /**
45
+ * Follow the <a
46
+ * href="https://github.com/oasis-tcs/amqp-specs/blob/master/http-over-amqp-v1.0-wd06a.docx">HTTP
47
+ * Semantics and Content over AMQP Version 1.0</a> extension specification.
48
+ *
49
+ * @see <a
50
+ * href="https://github.com/oasis-tcs/amqp-specs/blob/master/http-over-amqp-v1.0-wd06a.docx">HTTP
51
+ * Semantics and Content over AMQP Version 1.0</a>
52
+ */
44
53
class AmqpManagement implements Management {
45
54
46
55
private static final AtomicLong ID_SEQUENCE = new AtomicLong (0 );
@@ -341,8 +350,7 @@ private Response<Map<String, Object>> declare(
341
350
checkAvailable ();
342
351
UUID requestId = messageId ();
343
352
try {
344
- Message <?> request =
345
- Message .create (body ).messageId (requestId ).to (target ).subject (operation ).replyTo (REPLY_TO );
353
+ Message <?> request = Message .create (body ).to (target ).subject (operation );
346
354
347
355
OutstandingRequest outstandingRequest = this .request (request , requestId );
348
356
outstandingRequest .block ();
@@ -355,6 +363,10 @@ private Response<Map<String, Object>> declare(
355
363
}
356
364
357
365
OutstandingRequest request (Message <?> request , UUID requestId ) throws ClientException {
366
+ // HTTP over AMQP 1.0 extension specification, 5.1:
367
+ // To associate a response with a request, the correlation-id value of the response properties
368
+ // MUST be set to the message-id value of the request properties.
369
+ request .messageId (requestId ).replyTo (REPLY_TO );
358
370
OutstandingRequest outstandingRequest = new OutstandingRequest (this .rpcTimeout );
359
371
LOGGER .debug ("Enqueueing request {}" , requestId );
360
372
this .outstandingRequests .put (requestId , outstandingRequest );
@@ -382,12 +394,7 @@ private Map<String, Object> delete(String target, int expectedResponseCode) {
382
394
checkAvailable ();
383
395
UUID requestId = messageId ();
384
396
try {
385
- Message <?> request =
386
- Message .create ((Map <?, ?>) null )
387
- .messageId (requestId )
388
- .to (target )
389
- .subject (DELETE )
390
- .replyTo (REPLY_TO );
397
+ Message <?> request = Message .create ((Map <?, ?>) null ).to (target ).subject (DELETE );
391
398
392
399
OutstandingRequest outstandingRequest = request (request , requestId );
393
400
outstandingRequest .block ();
@@ -497,12 +504,7 @@ private static Optional<String> matchBinding(
497
504
private OutstandingRequest get (String target ) throws ClientException {
498
505
checkAvailable ();
499
506
UUID requestId = messageId ();
500
- Message <?> request =
501
- Message .create ((Map <?, ?>) null )
502
- .messageId (requestId )
503
- .to (target )
504
- .subject (GET )
505
- .replyTo (REPLY_TO );
507
+ Message <?> request = Message .create ((Map <?, ?>) null ).to (target ).subject (GET );
506
508
507
509
OutstandingRequest outstandingRequest = request (request , requestId );
508
510
outstandingRequest .block ();
0 commit comments