Java Code Examples for org.springframework.amqp.core.TopicExchange

The following examples show how to use org.springframework.amqp.core.TopicExchange. These examples are extracted from open source projects. 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 Project: generic-vnfm   Source File: EMSConfiguration.java    License: Apache License 2.0 6 votes vote down vote up
@PostConstruct
private void init() {
  log.info("Initialization of RabbitConfiguration");

  emsConnectionFactory = new CachingConnectionFactory();
  ((CachingConnectionFactory) emsConnectionFactory).setHost(brokerIp);
  ((CachingConnectionFactory) emsConnectionFactory).setPort(rabbitPort);
  ((CachingConnectionFactory) emsConnectionFactory).setUsername(emsRabbitUsername);
  ((CachingConnectionFactory) emsConnectionFactory).setPassword(emsRabbitPassword);

  rabbitAdmin = new RabbitAdmin(emsConnectionFactory);
  TopicExchange topicExchange = new TopicExchange("openbaton-exchange");
  rabbitAdmin.declareExchange(topicExchange);
  log.info("exchange declared");

  queueName_emsRegistrator = "ems." + vnfmHelper.getVnfmEndpoint() + ".register";
  rabbitAdmin.declareQueue(new Queue(queueName_emsRegistrator, durable, exclusive, autodelete));
}
 
Example 2
@Bean
public RabbitAdmin rabbitAdmin(Queue queue, ConnectionFactory connectionFactory) {
  final TopicExchange exchange = new TopicExchange("myExchange", true, false);

  final RabbitAdmin admin = new RabbitAdmin(connectionFactory);
  admin.declareQueue(queue);
  admin.declareExchange(exchange);
  admin.declareBinding(BindingBuilder.bind(queue).to(exchange).with("#"));

  return admin;
}
 
Example 3
Source Project: rabbitmq-mock   Source File: SpringIntegrationTest.java    License: Apache License 2.0 5 votes vote down vote up
private RabbitTemplate queueAndExchangeSetup(BeanFactory context) {
    RabbitAdmin rabbitAdmin = context.getBean(RabbitAdmin.class);

    Queue queue = new Queue(QUEUE_NAME, false);
    rabbitAdmin.declareQueue(queue);
    TopicExchange exchange = new TopicExchange(EXCHANGE_NAME);
    rabbitAdmin.declareExchange(exchange);
    rabbitAdmin.declareBinding(BindingBuilder.bind(queue).to(exchange).with("test.*"));


    return context.getBean(RabbitTemplate.class);
}
 
Example 4
private List<TopicExchange> serviceExchanges() {
	return rabbitMqConfig.getServiceRoutings().stream().map(rabbitMqConfig::getExchangeName).map(e -> {
		TopicExchange exchange = new TopicExchange(e);
		exchanegMap.put(e, exchange);
		return exchange;
	}).collect(Collectors.toList());
}
 
Example 5
private List<TopicExchange> eventExchanges() {
	return rabbitMqConfig.getEventRoutings().stream().map(rabbitMqConfig::getExchangeName).map(e -> {
		TopicExchange exchange = new TopicExchange(e);
		exchanegMap.put(e, exchange);
		return exchange;
	}).collect(Collectors.toList());
}
 
Example 6
Source Project: articles   Source File: EventSubscriberConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public Binding binding(Queue eventReceivingQueue, TopicExchange receiverExchange) {
    if (routingKey == null) {
        throw new IllegalStateException("No events to listen to! Please specify the routing key for the events to listen to with the property 'subscriber.routingKey' (see EventPublisher for available routing keys).");
    }
    return BindingBuilder
            .bind(eventReceivingQueue)
            .to(receiverExchange)
            .with(routingKey);
}
 
Example 7
Source Project: code-examples   Source File: EventSubscriberConfiguration.java    License: MIT License 5 votes vote down vote up
@Bean
public Binding binding(Queue eventReceivingQueue, TopicExchange receiverExchange) {
  if (routingKey == null) {
    throw new IllegalStateException("No events to listen to! Please specify the routing key for the events to listen to with the property 'subscriber.routingKey' (see EventPublisher for available routing keys).");
  }
  return BindingBuilder
          .bind(eventReceivingQueue)
          .to(receiverExchange)
          .with(routingKey);
}
 
Example 8
Source Project: code-examples   Source File: MessageConsumerConfiguration.java    License: MIT License 5 votes vote down vote up
@Bean
public Binding binding(Queue eventReceivingQueue, TopicExchange receiverExchange) {
	return BindingBuilder
					.bind(eventReceivingQueue)
					.to(receiverExchange)
					.with("*.*");
}
 
Example 9
@Bean
List<Binding> binding(TopicExchange exchange) {
    List<Binding> bindings = new ArrayList<>();

    queues().forEach(queue -> {
        bindings.add(BindingBuilder.bind(queue).to(exchange).with(queue.getName()));
    });

    return bindings;
}
 
Example 10
@Bean
Binding binding(Queue queue, TopicExchange exchange) {
	return BindingBuilder.bind(queue).to(exchange).with(queueName);
}
 
Example 11
Source Project: Spring-Boot-Book   Source File: RabbitmqConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
Binding bindingExchangeMessage(Queue queueMessage, TopicExchange exchange) {
    return BindingBuilder.bind(queueMessage).to(exchange).with("topic.a");
}
 
Example 12
Source Project: Spring-Boot-Book   Source File: RabbitmqConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
Binding bindingExchangeMessages(Queue queueMessages, TopicExchange exchange) {
    return BindingBuilder.bind(queueMessages).to(exchange).with("topic.#");
}
 
Example 13
Source Project: micro-service   Source File: RabbitMQService.java    License: MIT License 4 votes vote down vote up
@Bean
Binding binding(Queue queue, TopicExchange exchange) {
	return BindingBuilder.bind(queue).to(exchange).with(ROUTING_KEY);
}
 
Example 14
@Bean
TopicExchange output() {
	return new TopicExchange("output");
}
 
Example 15
@Bean
Binding binding(Queue queue, @Qualifier("input") TopicExchange exchange) {
	return BindingBuilder.bind(queue).to(exchange).with("#");
}
 
Example 16
Source Project: cloud-service   Source File: RabbitmqConfig.java    License: MIT License 4 votes vote down vote up
@Bean
public TopicExchange userTopicExchange() {
	return new TopicExchange(UserCenterMq.MQ_EXCHANGE_USER);
}
 
Example 17
Source Project: cloud-service   Source File: RabbitmqConfig.java    License: MIT License 4 votes vote down vote up
@Bean
public TopicExchange topicExchange() {
	return new TopicExchange(UserCenterMq.MQ_EXCHANGE_USER);
}
 
Example 18
Source Project: cukes   Source File: RabbitMQConfiguration.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
Exchange exchange() {
    return new TopicExchange(EXCHANGE_NAME);
}
 
Example 19
@Bean
public TopicExchange inventoryPublishExchange() {
    return new TopicExchange("inventory-publish-x", true, false, ImmutableMap.of("alternate-exchange", "inventory-publish-dlx"));
}
 
Example 20
Source Project: springboot-example   Source File: TopicConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
TopicExchange topicExchange() {
    return new TopicExchange(TopicConfig.EXCHANGE_NAME);
}
 
Example 21
Source Project: springboot-example   Source File: TopicConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
Binding bindingtopicExchangeQueue(Queue queuetopic, TopicExchange topicExchange) {
    return BindingBuilder.bind(queuetopic).to(topicExchange).with("log.#");
}
 
Example 22
Source Project: springboot-example   Source File: TopicConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
Binding bindingtopicExchangeQueue2(Queue queuetopic2, TopicExchange topicExchange) {
    return BindingBuilder.bind(queuetopic2).to(topicExchange).with("log.*");
}
 
Example 23
Source Project: springboot-example   Source File: TopicConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
Binding bindingtopicExchangeQueue3(Queue queuetopic3, TopicExchange topicExchange) {
    return BindingBuilder.bind(queuetopic3).to(topicExchange).with("log.*.error");
}
 
Example 24
Source Project: rabbitmq-mock   Source File: AmqpApplication.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
public TopicExchange exchange() {
    return new TopicExchange("spring-boot-exchange");
}
 
Example 25
Source Project: rabbitmq-mock   Source File: AmqpApplication.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
public Binding binding(Queue queue, TopicExchange exchange) {
    return BindingBuilder.bind(queue).to(exchange).with(QUEUE_NAME);
}
 
Example 26
Source Project: java-specialagent   Source File: SpringRabbitMQITest.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
TopicExchange exchange() {
  return new TopicExchange(topicExchangeName);
}
 
Example 27
Source Project: java-specialagent   Source File: SpringRabbitMQITest.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
Binding binding(final Queue queue, final TopicExchange exchange) {
  return BindingBuilder.bind(queue).to(exchange).with("foo.bar.#");
}
 
Example 28
@Bean("requestPaymentExchange")
public TopicExchange requestPaymentExchange() {
  return new TopicExchange("request-payment", true, false);
}
 
Example 29
@Bean("responsePaymentExchange")
public TopicExchange responsePaymentExchange() {
  return new TopicExchange("response-payment", true, false);
}
 
Example 30
@Bean("requestPaymentExchangeBinding")
public Binding requestPaymentExchangeBinding(@Qualifier("requestPaymentQueue") Queue requestPaymentQueue,@Qualifier("requestPaymentExchange") TopicExchange requestPaymentExchange) {
  return BindingBuilder.bind(requestPaymentQueue).to(requestPaymentExchange).with("*");
}