|
1 | 1 | /* |
2 | | - * Copyright 2016 the original author or authors. |
| 2 | + * Copyright 2016-2019 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
|
18 | 18 |
|
19 | 19 | import java.util.HashMap; |
20 | 20 | import java.util.Map; |
| 21 | +import java.util.UUID; |
21 | 22 |
|
22 | 23 | import org.springframework.amqp.core.MessageDeliveryMode; |
23 | 24 | import org.springframework.amqp.rabbit.connection.Connection; |
|
51 | 52 | public abstract class AbstractAmqpOutboundEndpoint extends AbstractReplyProducingMessageHandler |
52 | 53 | implements Lifecycle { |
53 | 54 |
|
| 55 | + private static final UUID NO_ID = new UUID(0L, 0L); |
| 56 | + |
54 | 57 | private String exchangeName; |
55 | 58 |
|
56 | 59 | private String routingKey; |
@@ -429,8 +432,18 @@ public boolean isRunning() { |
429 | 432 | protected CorrelationData generateCorrelationData(Message<?> requestMessage) { |
430 | 433 | CorrelationData correlationData = null; |
431 | 434 | if (this.correlationDataGenerator != null) { |
432 | | - correlationData = new CorrelationDataWrapper(requestMessage.getHeaders().getId().toString(), |
433 | | - this.correlationDataGenerator.processMessage(requestMessage), requestMessage); |
| 435 | + UUID messageId = requestMessage.getHeaders().getId(); |
| 436 | + if (messageId == null) { |
| 437 | + messageId = NO_ID; |
| 438 | + } |
| 439 | + Object userData = this.correlationDataGenerator.processMessage(requestMessage); |
| 440 | + if (userData != null) { |
| 441 | + correlationData = new CorrelationDataWrapper(messageId.toString(), userData, requestMessage); |
| 442 | + } |
| 443 | + else { |
| 444 | + this.logger.debug("'confirmCorrelationExpression' resolved to 'null'; " |
| 445 | + + "no publisher confirm will be sent to the ack or nack channel"); |
| 446 | + } |
434 | 447 | } |
435 | 448 | return correlationData; |
436 | 449 | } |
|
0 commit comments