Added parametrization of RabbitMQ brokers (#1448)
without this change we're reusing the same broker for application logic and sending spans to zipkin with this change we're adding a property to allow providing a different set of addresses for brokers to send spans to Zipkin fixes gh-1210
This commit is contained in:
committed by
GitHub
parent
6d645faa59
commit
38ffcbc932
@@ -29,6 +29,7 @@ import org.springframework.cloud.sleuth.zipkin2.ZipkinAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnBean(CachingConnectionFactory.class)
|
||||
@@ -40,12 +41,17 @@ class ZipkinRabbitSenderConfiguration {
|
||||
@Value("${spring.zipkin.rabbitmq.queue:zipkin}")
|
||||
private String queue;
|
||||
|
||||
@Value("${spring.zipkin.rabbitmq.addresses:}")
|
||||
private String addresses;
|
||||
|
||||
@Bean(ZipkinAutoConfiguration.SENDER_BEAN_NAME)
|
||||
Sender rabbitSender(CachingConnectionFactory connectionFactory,
|
||||
RabbitProperties config) {
|
||||
String addresses = StringUtils.hasText(this.addresses) ? this.addresses
|
||||
: config.determineAddresses();
|
||||
return RabbitMQSender.newBuilder()
|
||||
.connectionFactory(connectionFactory.getRabbitConnectionFactory())
|
||||
.queue(this.queue).addresses(config.determineAddresses()).build();
|
||||
.queue(this.queue).addresses(addresses).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,11 @@
|
||||
"description": "Name of the RabbitMQ queue where spans should be sent to Zipkin.",
|
||||
"defaultValue": "zipkin"
|
||||
},
|
||||
{
|
||||
"name": "spring.zipkin.rabbitmq.addresses",
|
||||
"type": "java.lang.String",
|
||||
"description": "Addresses of the RabbitMQ brokers used to send spans to Zipkin"
|
||||
},
|
||||
{
|
||||
"name": "spring.zipkin.activemq.queue",
|
||||
"type": "java.lang.String",
|
||||
|
||||
Reference in New Issue
Block a user