Package org.springframework.amqp.rabbit.connection

Examples of org.springframework.amqp.rabbit.connection.ConnectionFactory


      Assert.assertNotNull(endpoint.toString());
    }   
       
    @Override
    protected CamelContext createCamelContext() throws Exception {
        ConnectionFactory factory = new CachingConnectionFactory();
       
        CamelContext camelContext = super.createCamelContext();
        camelContext.addComponent("spring-amqp", new SpringAMQPComponent(factory));
        return camelContext;
    }
View Full Code Here


        Assert.assertEquals(child, SpringAMQPComponent.findRootCause(grandparent));
    }
   
    @Override
    protected CamelContext createCamelContext() throws Exception {
        ConnectionFactory factory = new CachingConnectionFactory();
       
        CamelContext camelContext = super.createCamelContext();
        camelContext.addComponent("spring-amqp", new SpringAMQPComponent(factory));
        return camelContext;
    }
View Full Code Here

        config.setAcknowledgeMode(AcknowledgeMode.AUTO);
        Advice[] adviceChain = new Advice[0];
        config.setAdviceChain(adviceChain);
        config.setConcurrentConsumers(5);
        ConnectionFactory mockConnectionFactory = mock(ConnectionFactory.class);
        testSubject.setConnectionFactory(mockConnectionFactory);
        ErrorHandler mockErrorHandler = mock(ErrorHandler.class);
        config.setErrorHandler(mockErrorHandler);
        MessagePropertiesConverter mockMessagePropertiesConverter = mock(MessagePropertiesConverter.class);
        config.setMessagePropertiesConverter(mockMessagePropertiesConverter);
View Full Code Here

*/
public class BigOperationWorker {

    public static void main(String[] args) {
        final ApplicationContext rabbitConfig = new AnnotationConfigApplicationContext(RabbitConfiguration.class);
        final ConnectionFactory rabbitConnectionFactory = rabbitConfig.getBean(ConnectionFactory.class);
        final Queue rabbitQueue = rabbitConfig.getBean(Queue.class);
        final MessageConverter messageConverter = new SimpleMessageConverter();

        // create a listener container, which is required for asynchronous message consumption.
        // AmqpTemplate cannot be used in this case
View Full Code Here

     *
     * @param exclusive Whether the created container should be an exclusive listener
     */
    public void setExclusive(boolean exclusive) {
        isExclusive = exclusive;
        final ConnectionFactory connectionFactory = getConnectionFactory();
        if (connectionFactory instanceof ExclusiveConnectionFactory) {
            setConnectionFactory(((ExclusiveConnectionFactory) connectionFactory).getDelegate());
        }
        if (exclusive) {
            setConcurrentConsumers(1);
View Full Code Here

        config.setAcknowledgeMode(AcknowledgeMode.AUTO);
        Advice[] adviceChain = new Advice[0];
        config.setAdviceChain(adviceChain);
        config.setConcurrentConsumers(5);
        ConnectionFactory mockConnectionFactory = mock(ConnectionFactory.class);
        testSubject.setConnectionFactory(mockConnectionFactory);
        ErrorHandler mockErrorHandler = mock(ErrorHandler.class);
        config.setErrorHandler(mockErrorHandler);
        MessagePropertiesConverter mockMessagePropertiesConverter = mock(MessagePropertiesConverter.class);
        config.setMessagePropertiesConverter(mockMessagePropertiesConverter);
View Full Code Here

  public void testWithNoId() throws Exception {
    // 2 messsages; each retried once by missing id interceptor
    this.latch = new CountDownLatch(4);
    ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext("retry-context.xml", this.getClass());
    RabbitTemplate template = ctx.getBean(RabbitTemplate.class);
    ConnectionFactory connectionFactory = ctx.getBean(ConnectionFactory.class);
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory);
    container.setMessageListener(new MessageListenerAdapter(new POJO()));
    container.setQueueNames("retry.test.queue");

    StatefulRetryOperationsInterceptorFactoryBean fb = new StatefulRetryOperationsInterceptorFactoryBean();
View Full Code Here

  public void testWithId() throws Exception {
    // 2 messsages; each retried twice by retry interceptor
    this.latch = new CountDownLatch(6);
    ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext("retry-context.xml", this.getClass());
    RabbitTemplate template = ctx.getBean(RabbitTemplate.class);
    ConnectionFactory connectionFactory = ctx.getBean(ConnectionFactory.class);
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory);
    container.setMessageListener(new MessageListenerAdapter(new POJO()));
    container.setQueueNames("retry.test.queue");

    StatefulRetryOperationsInterceptorFactoryBean fb = new StatefulRetryOperationsInterceptorFactoryBean();
View Full Code Here

   * txSize = 2; 4 messages; should get 2 acks (#2 and #4)
   */
  @SuppressWarnings("unchecked")
  @Test
  public void testTxSizeAcks() throws Exception {
    ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
    Connection connection = mock(Connection.class);
    Channel channel = mock(Channel.class);
    when(connectionFactory.createConnection()).thenReturn(connection);
    when(connection.createChannel(false)).thenReturn(channel);
    final AtomicReference<Consumer> consumer = new AtomicReference<Consumer>();
    doAnswer(new Answer<Object>() {

      @Override
View Full Code Here

   * after timeout.
   */
  @SuppressWarnings("unchecked")
  @Test
  public void testTxSizeAcksWIthShortSet() throws Exception {
    ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
    Connection connection = mock(Connection.class);
    Channel channel = mock(Channel.class);
    when(connectionFactory.createConnection()).thenReturn(connection);
    when(connection.createChannel(false)).thenReturn(channel);
    final AtomicReference<Consumer> consumer = new AtomicReference<Consumer>();
    doAnswer(new Answer<Object>() {

      @Override
View Full Code Here

TOP

Related Classes of org.springframework.amqp.rabbit.connection.ConnectionFactory

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.