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

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

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

origin: spring-projects/spring-amqp

@Override
public void setQueueNames(String... queueName) {
  Assert.state(!isRunning(), "Cannot set queue names while running, use add/remove");
  super.setQueueNames(queueName);
}
origin: spring-projects/spring-amqp

private void removeQueues(Stream<String> queueNames) {
  if (isRunning()) {
    synchronized (this.consumersMonitor) {
      checkStartState();
      queueNames.map(this.consumersByQueue::remove)
          .filter(Objects::nonNull)
          .flatMap(Collection::stream)
          .forEach(this::cancelConsumer);
    }
  }
}
origin: spring-projects/spring-amqp

private void checkStartState() {
  if (!this.isRunning()) {
    try {
      Assert.state(this.startedLatch.await(START_WAIT_TIME, TimeUnit.SECONDS),
          "Container is not started - cannot adjust queues");
    }
    catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new AmqpException("Interrupted waiting for start", e);
    }
  }
}
origin: org.springframework.amqp/spring-rabbit

@Override
public void setQueueNames(String... queueName) {
  Assert.state(!isRunning(), "Cannot set queue names while running, use add/remove");
  super.setQueueNames(queueName);
}
origin: org.springframework.amqp/spring-rabbit

private void checkStartState() {
  if (!this.isRunning()) {
    try {
      Assert.state(this.startedLatch.await(START_WAIT_TIME, TimeUnit.SECONDS),
          "Container is not started - cannot adjust queues");
    }
    catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new AmqpException("Interrupted waiting for start", e);
    }
  }
}
origin: org.springframework.amqp/spring-rabbit

private void removeQueues(Stream<String> queueNames) {
  if (isRunning()) {
    synchronized (this.consumersMonitor) {
      checkStartState();
      queueNames.map(this.consumersByQueue::remove)
          .filter(Objects::nonNull)
          .flatMap(Collection::stream)
          .forEach(this::cancelConsumer);
    }
  }
}
origin: spring-projects/spring-amqp

/**
 * Each queue runs in its own consumer; set this property to create multiple
 * consumers for each queue.
 * If the container is already running, the number of consumers per queue will
 * be adjusted up or down as necessary.
 * @param consumersPerQueue the consumers per queue.
 */
public void setConsumersPerQueue(int consumersPerQueue) {
  if (isRunning()) {
    adjustConsumers(consumersPerQueue);
  }
  this.consumersPerQueue = consumersPerQueue;
}
origin: org.springframework.amqp/spring-rabbit

/**
 * Each queue runs in its own consumer; set this property to create multiple
 * consumers for each queue.
 * If the container is already running, the number of consumers per queue will
 * be adjusted up or down as necessary.
 * @param consumersPerQueue the consumers per queue.
 */
public void setConsumersPerQueue(int consumersPerQueue) {
  if (isRunning()) {
    adjustConsumers(consumersPerQueue);
  }
  this.consumersPerQueue = consumersPerQueue;
}
origin: spring-projects/spring-amqp

private void addQueues(Stream<String> queueNameStream) {
  if (isRunning()) {
    synchronized (this.consumersMonitor) {
      checkStartState();
      Set<String> current = getQueueNamesAsSet();
      queueNameStream.forEach(queue -> {
        if (current.contains(queue)) {
          this.logger.warn("Queue " + queue + " is already configured for this container: "
              + this + ", ignoring add");
        }
        else {
          consumeFromQueue(queue);
        }
      });
    }
  }
}
origin: org.springframework.amqp/spring-rabbit

private void addQueues(Stream<String> queueNameStream) {
  if (isRunning()) {
    synchronized (this.consumersMonitor) {
      checkStartState();
      Set<String> current = getQueueNamesAsSet();
      queueNameStream.forEach(queue -> {
        if (current.contains(queue)) {
          this.logger.warn("Queue " + queue + " is already configured for this container: "
              + this + ", ignoring add");
        }
        else {
          consumeFromQueue(queue);
        }
      });
    }
  }
}
origin: spring-projects/spring-amqp

while (!DirectMessageListenerContainer.this.started && isRunning()) {
  this.cancellationLock.reset();
  try {
origin: org.springframework.amqp/spring-rabbit

while (!DirectMessageListenerContainer.this.started && isRunning()) {
  this.cancellationLock.reset();
  try {
origin: spring-projects/spring-amqp

@Test
public void testNonManagedContainerDoesntStartWhenConnectionFactoryDestroyed() throws Exception {
  CachingConnectionFactory cf = new CachingConnectionFactory("localhost");
  ApplicationContext context = mock(ApplicationContext.class);
  cf.setApplicationContext(context);
  cf.addConnectionListener(connection -> {
    cf.onApplicationEvent(new ContextClosedEvent(context));
    cf.destroy();
  });
  DirectMessageListenerContainer container = new DirectMessageListenerContainer(cf);
  container.setMessageListener(m -> { });
  container.setQueueNames(Q1);
  container.setBeanName("stopAfterDestroyBeforeStart");
  container.afterPropertiesSet();
  container.start();
  int n = 0;
  while (n++ < 100 && container.isRunning()) {
    Thread.sleep(100);
  }
  assertFalse(container.isRunning());
}
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.listenerDirectMessageListenerContainerisRunning

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
  • removeQueues
  • setIdleEventInterval
  • removeQueues,
  • setIdleEventInterval,
  • setMessageListener,
  • setMissingQueuesFatal,
  • setMonitorInterval,
  • setPrefetchCount,
  • setQueueNames,
  • actualShutDown,
  • actualStart

Popular in Java

  • Making http post requests using okhttp
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • requestLocationUpdates (LocationManager)
  • putExtra (Intent)
  • Menu (java.awt)
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • UUID (java.util)
    UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • Table (org.hibernate.mapping)
    A relational table
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top Sublime Text plugins
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