Examples of TopicExchange


Examples of org.springframework.amqp.core.TopicExchange

  @Test
  // @Ignore("Not sure yet if we need to support a use case like this")
  public void testSendAndReceiveWithTopicConsumeInBackground() throws Exception {

    RabbitAdmin admin = new RabbitAdmin(connectionFactory);
    TopicExchange exchange = new TopicExchange("topic");
    admin.declareExchange(exchange);
    template.setExchange(exchange.getName());

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

    final CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory();
    cachingConnectionFactory.setHost("localhost");
    final RabbitTemplate template = new RabbitTemplate(cachingConnectionFactory);
    template.setExchange(exchange.getName());

    BlockingQueueConsumer consumer = template.execute(new ChannelCallback<BlockingQueueConsumer>() {
      @Override
      public BlockingQueueConsumer doInRabbit(Channel channel) throws Exception {

View Full Code Here

Examples of org.springframework.amqp.core.TopicExchange

  @Test
  public void testSendAndReceiveWithTopicTwoCallbacks() throws Exception {

    RabbitAdmin admin = new RabbitAdmin(connectionFactory);
    TopicExchange exchange = new TopicExchange("topic");
    admin.declareExchange(exchange);
    template.setExchange(exchange.getName());

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

    template.execute(new ChannelCallback<Void>() {
      @Override
View Full Code Here

Examples of org.springframework.amqp.core.TopicExchange

  protected void maybeDeclareExchange() {
    RabbitAdmin admin = new RabbitAdmin(connectionFactory);
    if (declareExchange) {
      Exchange x;
      if ("topic".equals(exchangeType)) {
        x = new TopicExchange(exchangeName, durable, autoDelete);
      }
      else if ("direct".equals(exchangeType)) {
        x = new DirectExchange(exchangeName, durable, autoDelete);
      }
      else if ("fanout".equals(exchangeType)) {
        x = new FanoutExchange(exchangeName, durable, autoDelete);
      }
      else if ("headers".equals(exchangeType)) {
        x = new HeadersExchange(exchangeType, durable, autoDelete);
      }
      else {
        x = new TopicExchange(exchangeName, durable, autoDelete);
      }
      // admin.deleteExchange(exchangeName);
      admin.declareExchange(x);
    }
  }
View Full Code Here

Examples of org.springframework.amqp.core.TopicExchange

  protected void maybeDeclareExchange() {
    RabbitAdmin admin = new RabbitAdmin(this.connectionFactory);
    if (this.declareExchange) {
      Exchange x;
      if ("topic".equals(this.exchangeType)) {
        x = new TopicExchange(this.exchangeName, this.durable, this.autoDelete);
      }
      else if ("direct".equals(this.exchangeType)) {
        x = new DirectExchange(this.exchangeName, this.durable, this.autoDelete);
      }
      else if ("fanout".equals(this.exchangeType)) {
        x = new FanoutExchange(this.exchangeName, this.durable, this.autoDelete);
      }
      else if ("headers".equals(this.exchangeType)) {
        x = new HeadersExchange(this.exchangeType, this.durable, this.autoDelete);
      }
      else {
        x = new TopicExchange(this.exchangeName, this.durable, this.autoDelete);
      }
      admin.declareExchange(x);
    }
  }
View Full Code Here

Examples of org.springframework.amqp.core.TopicExchange

    assertFalse(exchange.isAutoDelete());
  }

  @Test
  public void testTopicExchange() throws Exception {
    TopicExchange exchange = beanFactory.getBean("topic", TopicExchange.class);
    assertNotNull(exchange);
    assertEquals("topic", exchange.getName());
    assertTrue(exchange.isDurable());
    assertFalse(exchange.isAutoDelete());
    assertTrue(exchange.shouldDeclare());
    assertEquals(1, exchange.getDeclaringAdmins().size());

  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.