Java Code Examples for org.springframework.amqp.rabbit.core.RabbitTemplate#setExchange()

The following examples show how to use org.springframework.amqp.rabbit.core.RabbitTemplate#setExchange() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RabbitMqConfiguration.java    From Hands-On-High-Performance-with-Spring-5 with MIT License 5 votes vote down vote up
@Bean
public RabbitTemplate rabbitTemplate() {
	RabbitTemplate template = new RabbitTemplate(connectionFactory());
	template.setRoutingKey(ROUTING_KEY);
	template.setExchange(RABBIT_MESSAGE_EXCHANGE);
	template.setMessageConverter(messageConverter());
	return template;
}
 
Example 2
Source File: AbstractAmqpIntegrationTest.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private RabbitTemplate createDmfClient() {
    final RabbitTemplate template = new RabbitTemplate(connectionFactory);
    template.setMessageConverter(new Jackson2JsonMessageConverter());
    template.setReceiveTimeout(TimeUnit.SECONDS.toMillis(3));
    template.setReplyTimeout(TimeUnit.SECONDS.toMillis(3));
    template.setExchange(getExchange());
    return template;
}
 
Example 3
Source File: RabbitMQConfiguration.java    From cukes with Apache License 2.0 5 votes vote down vote up
@Bean
RabbitTemplate rabbitTemplate(org.springframework.amqp.rabbit.connection.ConnectionFactory  cf,
                              ObjectMapper mapper) {
    RabbitTemplate template = new RabbitTemplate(cf);
    template.setExchange(EXCHANGE_NAME);
    RetryTemplate retry = new RetryTemplate();
    ExponentialBackOffPolicy backOff = new ExponentialBackOffPolicy();
    backOff.setInitialInterval(1000);
    backOff.setMultiplier(1.5);
    backOff.setMaxInterval(60000);
    retry.setBackOffPolicy(backOff);
    template.setRetryTemplate(retry);
    template.setMessageConverter(new Jackson2JsonMessageConverter(mapper));
    return template;
}
 
Example 4
Source File: ITSpringRabbit.java    From brave with Apache License 2.0 5 votes vote down vote up
@Bean RabbitTemplate newRabbitTemplate(
  ConnectionFactory connectionFactory,
  Binding binding,
  SpringRabbitTracing springRabbitTracing
) {
  RabbitTemplate result = springRabbitTracing.newRabbitTemplate(connectionFactory);
  result.setExchange(binding.getExchange());
  return result;
}
 
Example 5
Source File: ITSpringRabbit.java    From brave with Apache License 2.0 5 votes vote down vote up
@Bean RabbitTemplate decorateRabbitTemplate(
  ConnectionFactory connectionFactory,
  Binding binding,
  SpringRabbitTracing springRabbitTracing
) {
  RabbitTemplate result = new RabbitTemplate(connectionFactory);
  result.setExchange(binding.getExchange());
  return springRabbitTracing.decorateRabbitTemplate(result);
}
 
Example 6
Source File: AmqpClient.java    From tutorials with MIT License 4 votes vote down vote up
@Bean RabbitTemplate amqpTemplate(ConnectionFactory factory) {
    RabbitTemplate template = new RabbitTemplate(factory);
    template.setRoutingKey("remoting.binding");
    template.setExchange("remoting.exchange");
    return template;
}
 
Example 7
Source File: ITSpringRabbit.java    From brave with Apache License 2.0 4 votes vote down vote up
void produceUntracedMessage() {
  RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
  rabbitTemplate.setExchange(exchange.getName());
  new HelloWorldProducer(rabbitTemplate, binding).send();
}