Example usage for org.springframework.amqp.core TopicExchange TopicExchange

List of usage examples for org.springframework.amqp.core TopicExchange TopicExchange

Introduction

In this page you can find the example usage for org.springframework.amqp.core TopicExchange TopicExchange.

Prototype

public TopicExchange(String name) 

Source Link

Usage

From source file:com.mtech.easyexchange.ordersolver.OrderSolverConfigurer.java

public static void main(String... args) throws Exception {

    ConnectionFactory cf = new CachingConnectionFactory("127.0.0.1");

    RabbitAdmin admin = new RabbitAdmin(cf);

    Queue queue = new Queue("OrderQueue");
    admin.declareQueue(queue);//from  ww  w .  ja va 2s . co m

    TopicExchange exchange = new TopicExchange("OrderExchange");
    admin.declareExchange(exchange);

    admin.declareBinding(BindingBuilder.bind(queue).to(exchange).with("*"));

    OrderMessageHolder holder = new OrderMessageHolder();

    OrderSolverThread ost = new OrderSolverThread(holder);
    ost.start();

    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(cf);
    container.setMessageListener(new OrderMessageConsumer(holder));
    container.setQueueNames("OrderQueue");
    container.start();
}

From source file:com.anton.dev.tqrbs2.basic.BasicJava.java

public static void main(String[] args) throws Exception {
    ConnectionFactory cf = new CachingConnectionFactory();

    // set up the queue, exchange, binding on the broker
    RabbitAdmin admin = new RabbitAdmin(cf);
    Queue queue = new Queue("myQueue");
    admin.declareQueue(queue);//from  www.j av a2 s.  c o m
    TopicExchange exchange = new TopicExchange("myExchange2");
    admin.declareExchange(exchange);
    admin.declareBinding(BindingBuilder.bind(queue).to(exchange).with("foo.*"));

    // set up the listener and container
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(cf);
    Object listener = new Object() {
        public void handleMessage(String foo) {
            LOGGER.info("Recibiendo Java: " + foo);
        }
    };
    MessageListenerAdapter adapter = new MessageListenerAdapter(listener);
    container.setMessageListener(adapter);
    container.setQueueNames("myQueue");
    container.start();

    // send something
    RabbitTemplate template = new RabbitTemplate(cf);
    String msg = "Hello, world Rabbit!";
    LOGGER.info("Enviando Java: " + msg);
    template.convertAndSend("myExchange2", "foo.bar", msg);
    Thread.sleep(1000);
    container.stop();
}

From source file:com.baocy.tut5.Tut5Config.java

@Bean
public TopicExchange topic() {
    return new TopicExchange("tut.topic");
}

From source file:io.curly.tagger.config.AmqpConfiguration.java

@Bean
TopicExchange artifactoryExchange() {
    return new TopicExchange("artifactory-exchange");
}

From source file:io.curly.gathering.AmqpConfiguration.java

@Bean
TopicExchange notificationExchange() {
    return new TopicExchange(Constants.Amqp.NOTIFICATION_EXCHANGE);
}

From source file:io.curly.advisor.integration.config.AmqpConfiguration.java

@Bean
TopicExchange notificationExchange() {
    return new TopicExchange("notification-exchange");
}

From source file:de.msg.message.amqp.AmqpConfiguration.java

@Bean
public TopicExchange exchange() {
    return new TopicExchange("FlightAwareTracking");
}

From source file:com.expedia.seiso.SeisoIntegrationConfig.java

@Bean
public Exchange seisoNotificationsExchange() {
    return new TopicExchange(seisoProperties.getChangeNotificationExchange());
}

From source file:io.curly.artifact.integration.config.AmqpConfiguration.java

@Bean
TopicExchange exchange() {
    return new TopicExchange("artifactory-exchange");
}

From source file:com.expedia.seiso.SeisoRabbitConfig.java

@Bean
public Exchange seisoNotificationsExchange() {
    return new TopicExchange(customProperties.getChangeNotificationExchange());
    // exchange.setAdminsThatShouldDeclare(rabbitAdmin());
}