Package org.springframework.amqp.rabbit.core

Examples of org.springframework.amqp.rabbit.core.RabbitTemplate


            }
        }
       
        if(this.amqpTemplate == null) {
            //Attempt to construct an AMQP template
            this.amqpTemplate = new RabbitTemplate(this.connectionFactory);
            LOG.info("Created new AMQP Template");
        }
       
        return this.amqpTemplate;
    }
View Full Code Here


        }
       
        if(this.amqpTemplate == null || this.amqpTemplate.isEmpty()) {
            //Attempt to construct an AMQP template
            this.amqpTemplate = new HashMap<String, AmqpTemplate>();
            this.amqpTemplate.put(DEFAULT_CONNECTION, new RabbitTemplate(this.connectionFactory.values().iterator().next()));
            LOG.info("Created new AMQP Template");
        }
       
        return this.amqpTemplate;
    }
View Full Code Here

        public RabbitMQMessageListener(SpringAMQPEndpoint endpoint) {
            this.listenerContainer = new SimpleMessageListenerContainer();
            this.listenerContainer.setTaskExecutor(new SpringAMQPExecutor(endpoint));

            RabbitTemplate template = (RabbitTemplate) endpoint.getAmqpTemplate();
            if(template != null) {
                this.msgConverter = template.getMessageConverter();
                this.listenerContainer.setConnectionFactory(template.getConnectionFactory());
            } else {
                LOG.error("No AMQP Template found! Cannot initialize message conversion or connections!");
            }

            this.listenerContainer.setQueueNames(endpoint.getQueueName());
View Full Code Here

        public RabbitMQMessageListener(SpringAMQPEndpoint endpoint) {
            this.listenerContainer = new SimpleMessageListenerContainer();
            this.listenerContainer.setTaskExecutor(new SpringAMQPExecutor(endpoint));

            RabbitTemplate template = (RabbitTemplate) endpoint.getAmqpTemplate();
            if(template != null) {
                this.msgConverter = template.getMessageConverter();
                this.listenerContainer.setConnectionFactory(template.getConnectionFactory());
            } else {
                LOG.error("No AMQP Template found! Cannot initialize message conversion or connections!");
            }

            this.listenerContainer.setQueueNames(endpoint.getQueueName());
View Full Code Here

 
  @Bean
  public RabbitService rabbitService() {
    return new RabbitService(vertx(), rabbitConnectionFactory(),
        new RabbitAdmin(rabbitConnectionFactory()),
        new RabbitTemplate(rabbitConnectionFactory()),
        rabbitTaskExecutor());
  }
View Full Code Here

    }
   
    @Override
    protected CamelContext createCamelContext() throws Exception {
        CachingConnectionFactory factory = new CachingConnectionFactory();
        RabbitTemplate amqpTemplate = new RabbitTemplate(factory);
        SpringAMQPComponent amqpComponent = new SpringAMQPComponent(factory);
        amqpComponent.setAmqpTemplate(amqpTemplate);
       
        CamelContext camelContext = super.createCamelContext();
        camelContext.addComponent("spring-amqp", amqpComponent);
View Full Code Here

    }

    @Override
    protected CamelContext createCamelContext() throws Exception {
        CachingConnectionFactory factory = new CachingConnectionFactory();
        RabbitTemplate amqpTemplate = new RabbitTemplate(factory);
        //The JSON converter stresses marshalling more than the default converter
        amqpTemplate.setMessageConverter(new JsonMessageConverter());
        SpringAMQPComponent amqpComponent = new SpringAMQPComponent(factory);
        amqpComponent.setAmqpTemplate(amqpTemplate);
       
        CamelContext camelContext = super.createCamelContext();
        camelContext.addComponent("spring-amqp", amqpComponent);
View Full Code Here

        public RabbitMQMessageListener(SpringAMQPEndpoint endpoint) {
            this.listenerContainer = new SimpleMessageListenerContainer();
            this.listenerContainer.setTaskExecutor(new SpringAMQPExecutor(endpoint));

            RabbitTemplate template = (RabbitTemplate) endpoint.getAmqpTemplate();
            if(template != null) {
                this.msgConverter = template.getMessageConverter();
                this.listenerContainer.setConnectionFactory(template.getConnectionFactory());
            } else {
                LOG.error("No AMQP Template found! Cannot initialize message conversion or connections!");
            }

            this.listenerContainer.setQueueNames(endpoint.getQueueName());
View Full Code Here

    return Collections.singletonMap("module.router.producer.deliveryMode", "NON_PERSISTENT");
  }

  @Override
  protected void verifyOnDemandQueues(MessageChannel y3, MessageChannel z3) {
    RabbitTemplate template = new RabbitTemplate(rabbitAvailableRule.getResource());
    Object y = template.receiveAndConvert("xdbus.queue:y");
    assertNotNull(y);
    assertEquals("y", y);
    Object z = template.receiveAndConvert("xdbus.queue:z");
    assertNotNull(z);
    assertEquals("z", z);
  }
View Full Code Here

      }

    });
    bus.bindConsumer("dlqtest", moduleInputChannel, properties);

    RabbitTemplate template = new RabbitTemplate(this.rabbitAvailableRule.getResource());
    template.convertAndSend("", "xdbustest.dlqtest", "foo");

    int n = 0;
    while (n++ < 100) {
      Object deadLetter = template.receiveAndConvert("xdbustest.dlqtest.dlq");
      if (deadLetter != null) {
        assertEquals("foo", deadLetter);
        break;
      }
      Thread.sleep(100);
View Full Code Here

TOP

Related Classes of org.springframework.amqp.rabbit.core.RabbitTemplate

Copyright © 2018 www.massapicom. 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.