Package org.springframework.amqp.rabbit.connection

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


      @Override
      public Object answer(InvocationOnMock invocation) throws Throwable {
        return count.incrementAndGet();
      }}).when(mockChannel).getNextPublishSeqNo();

    CachingConnectionFactory ccf = new CachingConnectionFactory(mockConnectionFactory);
    ccf.setPublisherConfirms(true);
    final RabbitTemplate template = new RabbitTemplate(ccf);

    final CountDownLatch latch = new CountDownLatch(2);
    template.setConfirmCallback(new ConfirmCallback() {
View Full Code Here


      public Object answer(InvocationOnMock invocation) throws Throwable {
        return count.incrementAndGet();
      }
    }).when(mockChannel).getNextPublishSeqNo();

    CachingConnectionFactory ccf = new CachingConnectionFactory(mockConnectionFactory);
    ccf.setPublisherConfirms(true);
    final RabbitTemplate template1 = new RabbitTemplate(ccf);

    final Set<String> confirms = new HashSet<String>();
    final CountDownLatch latch1 = new CountDownLatch(1);
    template1.setConfirmCallback(new ConfirmCallback() {
View Full Code Here

    when(mockConnectionFactory.newConnection((ExecutorService) null)).thenReturn(mockConnection);
    when(mockConnection.isOpen()).thenReturn(true);
    final PublisherCallbackChannelImpl channel = new PublisherCallbackChannelImpl(mockChannel);
    when(mockConnection.createChannel()).thenReturn(channel);

    CachingConnectionFactory ccf = new CachingConnectionFactory(mockConnectionFactory);
    ccf.setPublisherConfirms(true);
    ccf.setChannelCacheSize(3);
    final RabbitTemplate template = new RabbitTemplate(ccf);

    final CountDownLatch first2SentOnThread1Latch = new CountDownLatch(1);
    final CountDownLatch delayAckProcessingLatch = new CountDownLatch(1);
    final CountDownLatch startedProcessingMultiAcksLatch = new CountDownLatch(1);
View Full Code Here

  @Override
  public void append(LoggingEvent event) {
    if (null == senderPool && this.initializing.compareAndSet(false, true)) {
      try {
        connectionFactory = new CachingConnectionFactory();
        connectionFactory.setHost(host);
        connectionFactory.setPort(port);
        connectionFactory.setUsername(username);
        connectionFactory.setPassword(password);
        connectionFactory.setVirtualHost(virtualHost);
View Full Code Here

    super.start();
    this.routingKeyLayout.setContext(getContext());
    this.routingKeyLayout.start();
    this.locationLayout.setContext(getContext());
    this.locationLayout.start();
    this.connectionFactory = new CachingConnectionFactory();
    this.connectionFactory.setHost(this.host);
    this.connectionFactory.setPort(this.port);
    this.connectionFactory.setUsername(this.username);
    this.connectionFactory.setPassword(this.password);
    this.connectionFactory.setVirtualHost(this.virtualHost);
View Full Code Here

  @Test
  public void testArgumentsQueue() throws Exception {

    Queue queue = beanFactory.getBean("arguments", Queue.class);
    assertNotNull(queue);
    CachingConnectionFactory connectionFactory = new CachingConnectionFactory(BrokerTestUtils.getPort());
    connectionFactory.setHost("localhost");
    RabbitTemplate template = new RabbitTemplate(connectionFactory);
    RabbitAdmin rabbitAdmin = new RabbitAdmin(template.getConnectionFactory());
    rabbitAdmin.deleteQueue(queue.getName());
    rabbitAdmin.declareQueue(queue);

    assertEquals(100L, queue.getArguments().get("x-message-ttl"));
    template.convertAndSend(queue.getName(), "message");

    Thread.sleep(200);
    String result = (String) template.receiveAndConvert(queue.getName());
    assertEquals(null, result);

    connectionFactory.destroy();

  }
View Full Code Here

TOP

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

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.