Tabnine Logo
DirectMessageListenerContainer.setIdleEventInterval
Code IndexAdd Tabnine to your IDE (free)

How to use
setIdleEventInterval
method
in
org.springframework.amqp.rabbit.listener.DirectMessageListenerContainer

Best Java code snippets using org.springframework.amqp.rabbit.listener.DirectMessageListenerContainer.setIdleEventInterval (Showing top 4 results out of 315)

origin: spring-projects/spring-amqp

public DirectReplyToMessageListenerContainer(ConnectionFactory connectionFactory) {
  super(connectionFactory);
  super.setQueueNames(Address.AMQ_RABBITMQ_REPLY_TO);
  setAcknowledgeMode(AcknowledgeMode.NONE);
  super.setConsumersPerQueue(0);
  super.setIdleEventInterval(DEFAULT_IDLE);
}
origin: org.springframework.amqp/spring-rabbit

public DirectReplyToMessageListenerContainer(ConnectionFactory connectionFactory) {
  super(connectionFactory);
  super.setQueueNames(Address.AMQ_RABBITMQ_REPLY_TO);
  setAcknowledgeMode(AcknowledgeMode.NONE);
  super.setConsumersPerQueue(0);
  super.setIdleEventInterval(DEFAULT_IDLE);
}
origin: spring-projects/spring-amqp

@Test
public void testEvents() throws Exception {
  CachingConnectionFactory cf = new CachingConnectionFactory("localhost");
  DirectMessageListenerContainer container = new DirectMessageListenerContainer(cf);
  container.setQueueNames(EQ1, EQ2);
  final List<Long> times = new ArrayList<>();
  final CountDownLatch latch1 = new CountDownLatch(2);
  final CountDownLatch latch2 = new CountDownLatch(2);
  container.setApplicationEventPublisher(event -> {
    if (event instanceof ListenerContainerIdleEvent) {
      times.add(System.currentTimeMillis());
      latch1.countDown();
    }
    else if (event instanceof ListenerContainerConsumerTerminatedEvent) {
      latch2.countDown();
    }
  });
  container.setMessageListener(m -> { });
  container.setIdleEventInterval(50L);
  container.setBeanName("events");
  container.setConsumerTagStrategy(new Tag());
  container.afterPropertiesSet();
  container.start();
  assertTrue(latch1.await(10, TimeUnit.SECONDS));
  assertThat(times.get(1) - times.get(0), greaterThanOrEqualTo(50L));
  brokerRunning.deleteQueues(EQ1, EQ2);
  assertTrue(latch2.await(10, TimeUnit.SECONDS));
  container.stop();
  cf.destroy();
}
origin: spring-projects/spring-amqp

@Test
public void testNonManagedContainerStopsWhenConnectionFactoryDestroyed() throws Exception {
  CachingConnectionFactory cf = new CachingConnectionFactory("localhost");
  ApplicationContext context = mock(ApplicationContext.class);
  cf.setApplicationContext(context);
  DirectMessageListenerContainer container = new DirectMessageListenerContainer(cf);
  final CountDownLatch latch = new CountDownLatch(1);
  container.setMessageListener(m -> {
    latch.countDown();
  });
  container.setQueueNames(Q1);
  container.setBeanName("stopAfterDestroy");
  container.setIdleEventInterval(500);
  container.setFailedDeclarationRetryInterval(500);
  container.afterPropertiesSet();
  container.start();
  new RabbitTemplate(cf).convertAndSend(Q1, "foo");
  assertTrue(latch.await(10, TimeUnit.SECONDS));
  cf.onApplicationEvent(new ContextClosedEvent(context));
  cf.destroy();
  int n = 0;
  while (n++ < 100 && container.isRunning()) {
    Thread.sleep(100);
  }
  assertFalse(container.isRunning());
}
org.springframework.amqp.rabbit.listenerDirectMessageListenerContainersetIdleEventInterval

Popular methods of DirectMessageListenerContainer

  • <init>
    Create an instance with the provided connection factory.
  • setConsumersPerQueue
    Each queue runs in its own consumer; set this property to create multiple consumers for each queue.
  • setAckTimeout
    An approximate timeout; when #setMessagesPerAck(int) is greater than 1, and this time elapses since
  • setMessagesPerAck
    Set the number of messages to receive before acknowledging (success). A failed message will short-ci
  • addQueues
  • afterPropertiesSet
  • getAcknowledgeMode
  • getConnectionFactory
  • getQueueNames
  • isActive
  • isRunning
  • removeQueues
  • isRunning,
  • removeQueues,
  • setMessageListener,
  • setMissingQueuesFatal,
  • setMonitorInterval,
  • setPrefetchCount,
  • setQueueNames,
  • actualShutDown,
  • actualStart

Popular in Java

  • Reading from database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setScale (BigDecimal)
  • runOnUiThread (Activity)
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now