Binder changes related to GH-1729

addressed PR comment

Resolves #250
This commit is contained in:
Oleg Zhurakousky
2019-06-12 18:20:37 +02:00
parent 1b4ccdb777
commit a52cda7057
3 changed files with 5 additions and 13 deletions

View File

@@ -7,7 +7,7 @@
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-build</artifactId>
<version>2.2.0.M2</version>
<version>2.2.0.BUILD-SNAPSHOT</version>
<relativePath />
</parent>
<properties>

View File

@@ -53,14 +53,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-jmx</artifactId>

View File

@@ -494,6 +494,7 @@ public class RabbitMessageChannelBinder extends
AmqpInboundChannelAdapter adapter = new AmqpInboundChannelAdapter(
listenerContainer);
adapter.setBindSourceMessage(true);
adapter.setBeanFactory(this.getBeanFactory());
adapter.setBeanName("inbound." + destination);
DefaultAmqpHeaderMapper mapper = DefaultAmqpHeaderMapper.inboundMapper();
@@ -609,8 +610,8 @@ public class RabbitMessageChannelBinder extends
public void handleMessage(
org.springframework.messaging.Message<?> message)
throws MessagingException {
Message amqpMessage = (Message) message.getHeaders()
.get(AmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE);
Message amqpMessage = StaticMessageHeaderAccessor.getSourceData(message);
if (!(message instanceof ErrorMessage)) {
logger.error("Expected an ErrorMessage, not a "
+ message.getClass().toString() + " for: " + message);
@@ -695,8 +696,7 @@ public class RabbitMessageChannelBinder extends
public void handleMessage(
org.springframework.messaging.Message<?> message)
throws MessagingException {
Message amqpMessage = (Message) message.getHeaders()
.get(AmqpMessageHeaderErrorMessageStrategy.AMQP_RAW_MESSAGE);
Message amqpMessage = StaticMessageHeaderAccessor.getSourceData(message);
/*
* NOTE: The following IF and subsequent ELSE IF should never happen
* under normal interaction and it should always go to the last ELSE