Commit 3445d093 by Dave Syer

Fix RabbitAdmin so it actually finds the Declarables

parent f3ced9e0
......@@ -26,6 +26,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.netflix.hystrix.HystrixConstants;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.integration.annotation.IntegrationComponentScan;
......@@ -69,6 +70,9 @@ public class HystrixStreamAutoConfiguration {
@Autowired(required = false)
private ConnectionFactory primaryConnectionFactory;
@Autowired
private ApplicationContext context;
@Autowired(required = false)
private ObjectMapper objectMapper;
......@@ -112,7 +116,7 @@ public class HystrixStreamAutoConfiguration {
// TODO: set content type
/*
* .enrichHeaders(new ComponentConfigurer<HeaderEnricherSpec>() {
*
*
* @Override public void configure(HeaderEnricherSpec spec) {
* spec.header("content-type", "application/json", true); } })
*/
......@@ -124,6 +128,7 @@ public class HystrixStreamAutoConfiguration {
if (this.hystrixConnectionFactory != null) {
RabbitAdmin amqpAdmin = new RabbitAdmin(this.hystrixConnectionFactory);
hystrixStreamExchange().setAdminsThatShouldDeclare(amqpAdmin);
amqpAdmin.setApplicationContext(this.context);
amqpAdmin.afterPropertiesSet();
return this.hystrixConnectionFactory;
}
......
......@@ -31,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.netflix.hystrix.HystrixConstants;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.integration.dsl.IntegrationFlow;
......@@ -60,6 +61,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@ConditionalOnProperty(value = "turbine.amqp.enabled", matchIfMissing = true)
public class TurbineAmqpAutoConfiguration {
@Autowired
private ApplicationContext context;
@Autowired(required = false)
@TurbineConnectionFactory
private ConnectionFactory turbineConnectionFactory;
......@@ -110,6 +114,7 @@ public class TurbineAmqpAutoConfiguration {
hystrixStreamExchange().setAdminsThatShouldDeclare(amqpAdmin);
localTurbineAmqpQueueBinding().setAdminsThatShouldDeclare(amqpAdmin);
hystrixStreamQueue().setAdminsThatShouldDeclare(amqpAdmin);
amqpAdmin.setApplicationContext(this.context);
amqpAdmin.afterPropertiesSet();
return this.turbineConnectionFactory;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment