Package org.springframework.amqp.rabbit.connection

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


    when(mockConnectionFactory.newConnection((ExecutorService) null)).thenReturn(mockConnection);
    when(mockConnection.isOpen()).thenReturn(true);
    when(mockConnection.createChannel()).thenReturn(mockChannel);

    final RabbitTemplate template = new RabbitTemplate(new SingleConnectionFactory(mockConnectionFactory));
    Queue replyQueue = new Queue("replyTo2");
    template.setReplyQueue(replyQueue);

    MessageProperties messageProperties = new MessageProperties();
    messageProperties.setReplyTo("replyTo1");
View Full Code Here


    when(mockConnectionFactory.newConnection((ExecutorService) null)).thenReturn(mockConnection);
    when(mockConnection.isOpen()).thenReturn(true);
    when(mockConnection.createChannel()).thenReturn(mockChannel);

    final RabbitTemplate template = new RabbitTemplate(new SingleConnectionFactory(mockConnectionFactory));
    template.setCorrelationKey(CORRELATION_HEADER);
    Queue replyQueue = new Queue("new.replyTo");
    template.setReplyQueue(replyQueue);

    MessageProperties messageProperties = new MessageProperties();
View Full Code Here

    when(mockConnectionFactory.newConnection((ExecutorService) null)).thenReturn(mockConnection);
    when(mockConnection.isOpen()).thenReturn(true);
    when(mockConnection.createChannel()).thenReturn(mockChannel);

    final RabbitTemplate template = new RabbitTemplate(new SingleConnectionFactory(mockConnectionFactory));
    template.setCorrelationKey(CORRELATION_HEADER);
    Queue replyQueue = new Queue("replyTo2");
    template.setReplyQueue(replyQueue);

    MessageProperties messageProperties = new MessageProperties();
View Full Code Here

        consumer.set((Consumer) invocation.getArguments()[6]);
        return null;
      }
    }).when(mockChannel).basicConsume(Mockito.anyString(), Mockito.anyBoolean(), Mockito.anyString(),
        Mockito.anyBoolean(), Mockito.anyBoolean(), Mockito.anyMap(), Mockito.any(Consumer.class));
    RabbitTemplate template = new RabbitTemplate(new SingleConnectionFactory(mockConnectionFactory));
    template.setReplyTimeout(1);
    Message input = new Message("Hello, world!".getBytes(), new MessageProperties());
    template.doSendAndReceiveWithTemporary("foo", "bar", input);
    Envelope envelope = new Envelope(1, false, "foo", "bar");
    // used to hang here because of the SynchronousQueue and doSendAndReceive() already exited
View Full Code Here

        count.incrementAndGet();
        throw new AuthenticationFailureException("foo");
      }
    }).when(mockConnectionFactory).newConnection((ExecutorService) null);

    RabbitTemplate template = new RabbitTemplate(new SingleConnectionFactory(mockConnectionFactory));
    template.setRetryTemplate(new RetryTemplate());
    try {
      template.convertAndSend("foo", "bar", "baz");
    }
    catch (AmqpAuthenticationException e) {
View Full Code Here

        count.incrementAndGet();
        throw new AuthenticationFailureException("foo");
      }
    }).when(mockConnectionFactory).newConnection((ExecutorService) null);

    RabbitTemplate template = new RabbitTemplate(new SingleConnectionFactory(mockConnectionFactory));
    template.setRetryTemplate(new RetryTemplate());

    final AtomicBoolean recoverInvoked = new AtomicBoolean();

    template.setRecoveryCallback(new RecoveryCallback<Object>() {
View Full Code Here

    assertEquals(null, result);
  }

  @Test
  public void testSendAndReceiveTransactedWithUncachedConnection() throws Exception {
    final SingleConnectionFactory singleConnectionFactory = new SingleConnectionFactory("localhost");
    RabbitTemplate template = new RabbitTemplate(singleConnectionFactory);
    template.setChannelTransacted(true);
    template.convertAndSend(ROUTE, "message");
    String result = (String) template.receiveAndConvert(ROUTE);
    assertEquals("message", result);
    result = (String) template.receiveAndConvert(ROUTE);
    assertEquals(null, result);
    singleConnectionFactory.destroy();
  }
View Full Code Here

    assertEquals(0, queues.size());
  }

  @Test
  public void testGetQueues() throws Exception {
    SingleConnectionFactory connectionFactory = new SingleConnectionFactory();
    connectionFactory.setPort(BrokerTestUtils.getAdminPort());
    Queue queue = new RabbitAdmin(connectionFactory).declareQueue();
    assertEquals("/", connectionFactory.getVirtualHost());
    List<QueueInfo> queues = brokerAdmin.getQueues();
    assertEquals(queue.getName(), queues.get(0).getName());
    connectionFactory.destroy();
  }
View Full Code Here

  private RabbitAdmin admin;

  @Before
  public void setup() throws Exception {
    connectionFactory = new SingleConnectionFactory();
    connectionFactory.setHost("localhost");
    this.admin = new RabbitAdmin(this.connectionFactory);
    deleteQueues();
  }
View Full Code Here

TOP

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

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.