congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
AmqpRunnableFactory
Code IndexAdd Tabnine to your IDE (free)

How to use
AmqpRunnableFactory
in
com.nesscomputing.amqp

Best Java code snippets using com.nesscomputing.amqp.AmqpRunnableFactory (Showing top 20 results out of 315)

origin: com.nesscomputing.components/ness-amqp

@Override
protected void configure()
{
  final Named connectionNamed;
  final AmqpConfig amqpConfig;
  connectionNamed = Names.named(connectionName);
  bind(new TypeLiteral<PublisherCallback<Object>>() {}).annotatedWith(JsonMapper.class).to(JsonPublisherCallback.class).in(Scopes.SINGLETON);
  bind(new TypeLiteral<PublisherCallback<String>>() {}).to(StringPublisherCallback.class).in(Scopes.SINGLETON);
  amqpConfig = config.getBean(AmqpConfig.class, ImmutableMap.of("name", connectionName));
  bind(AmqpConfig.class).annotatedWith(connectionNamed).toInstance(amqpConfig);
  if (amqpConfig.isEnabled()) {
    LOG.info("Enabling AMQP for '%s'", connectionName);
    bind(ConnectionFactory.class).annotatedWith(connectionNamed).toProvider(new AmqpFactoryProvider(amqpConfig)).in(Scopes.SINGLETON);
    bind(AmqpRunnableFactory.class).annotatedWith(connectionNamed).toInstance(new AmqpRunnableFactory(connectionNamed));
  }
  else {
    LOG.info("Disabled AMQP for '%s'", connectionName);
  }
}
origin: com.nesscomputing.components/ness-amqp

@Test
public void testSimpleProducer() throws Exception
{
  final ExchangePublisher<Object> exchangeConsumer = exchangeRunnableFactory.createExchangeJsonPublisher("test-topic");
  Assert.assertNotNull(exchangeConsumer);
}
origin: com.nesscomputing.components/ness-amqp

@Test
public void stopConsumerWithNoMessages() throws Exception
{
  final ExchangeConsumer exchangeConsumer = exchangeRunnableFactory.createExchangeListener("test-topic", new DummyMessageCallback());
  Assert.assertNotNull(exchangeConsumer);
  final Thread topicThread = new Thread(exchangeConsumer);
  topicThread.start();
  Thread.sleep(2000L);
  Assert.assertTrue(exchangeConsumer.isConnected());
  exchangeConsumer.shutdown();
  topicThread.interrupt();
  topicThread.join();
}
origin: com.nesscomputing.components/ness-amqp

final ExchangeConsumer exchangeConsumer = exchangeRunnableFactory.createExchangeListener("test-topic", callback);
final ExchangePublisher<Object> exchangeProducer = exchangeRunnableFactory.createExchangeJsonPublisher("test-topic");
final Thread consumerThread = new Thread(exchangeConsumer);
final Thread producerThread = new Thread(exchangeProducer);
origin: com.nesscomputing.components/ness-amqp

@Test
public void testProduceConsume() throws Exception
{
  final CountingMessageCallback cmc = new CountingMessageCallback();
  final QueueConsumer queueConsumer = queueRunnableFactory.createQueueListener("test-queue", cmc);
  final QueuePublisher<Object> queuePublisher = queueRunnableFactory.createQueueJsonPublisher("test-queue");
  final Thread consumerThread = new Thread(queueConsumer);
  final Thread producerThread = new Thread(queuePublisher);
  consumerThread.start();
  producerThread.start();
  Thread.sleep(1000L);
  Assert.assertTrue(queueConsumer.isConnected());
  Assert.assertFalse(queuePublisher.isConnected());
  final int maxCount = 1000;
  for (int i = 0; i < maxCount; i++) {
    queuePublisher.put(format("hello, world %d", i));
  }
  Thread.sleep(DRAIN_SLEEP);
  Assert.assertTrue(queuePublisher.isEmpty());
  Assert.assertEquals(maxCount, cmc.getCount());
  queuePublisher.shutdown();
  queueConsumer.shutdown();
  producerThread.interrupt();
  consumerThread.interrupt();
  producerThread.join();
  consumerThread.join();
}
origin: com.nesscomputing.components/ness-amqp

@Test
public void testSimpleProducer() throws Exception
{
  final QueuePublisher<Object> queuePublisher = queueRunnableFactory.createQueueJsonPublisher("test-queue");
  Assert.assertNotNull(queuePublisher);
}
origin: com.nesscomputing.components/ness-amqp

@Test
public void stopConsumerWithNoMessages() throws Exception
{
  final QueueConsumer queueConsumer = queueRunnableFactory.createQueueListener("test-queue", new DummyMessageCallback());
  Assert.assertNotNull(queueConsumer);
  final Thread queueThread = new Thread(queueConsumer);
  queueThread.start();
  Thread.sleep(2000L);
  Assert.assertTrue(queueConsumer.isConnected());
  queueConsumer.shutdown();
  queueThread.interrupt();
  queueThread.join();
}
origin: com.nesscomputing.components/ness-amqp

@Test
public void testProduceConsume() throws Exception
{
  final CountingMessageCallback cmc = new CountingMessageCallback();
  final ExchangeConsumer topicConsumer = exchangeRunnableFactory.createExchangeListener("test-topic", cmc);
  final ExchangePublisher<Object> topicProducer = exchangeRunnableFactory.createExchangeJsonPublisher("test-topic");
  final Thread consumerThread = new Thread(topicConsumer);
  final Thread producerThread = new Thread(topicProducer);
  consumerThread.start();
  producerThread.start();
  Thread.sleep(1000L);
  Assert.assertTrue(topicConsumer.isConnected());
  Assert.assertFalse(topicProducer.isConnected());
  final int maxCount = 1000;
  for (int i = 0; i < maxCount; i++) {
    topicProducer.put(format("hello, world %d", i));
  }
  Thread.sleep(DRAIN_SLEEP);
  Assert.assertTrue(topicProducer.isEmpty());
  Assert.assertEquals(maxCount, cmc.getCount());
  topicProducer.shutdown();
  topicConsumer.shutdown();
  producerThread.interrupt();
  consumerThread.interrupt();
  producerThread.join();
  consumerThread.join();
}
origin: com.nesscomputing.components/ness-amqp

final QueueConsumer queueConsumer1 = queueRunnableFactory.createQueueListener("test-queue", cmc1);
final QueueConsumer queueConsumer2 = queueRunnableFactory.createQueueListener("test-queue", cmc2);
final QueuePublisher<Object> queuePublisher = queueRunnableFactory.createQueueJsonPublisher("test-queue");
final Thread consumerThread1 = new Thread(queueConsumer1);
final Thread consumerThread2 = new Thread(queueConsumer2);
origin: com.nesscomputing.components/ness-amqp

@Test
public void stopProducerWithNoMessages() throws Exception
{
  final QueuePublisher<Object> queuePublisher = queueRunnableFactory.createQueueJsonPublisher("test-queue");
  Assert.assertNotNull(queuePublisher);
  final Thread queueThread = new Thread(queuePublisher);
  queueThread.start();
  Thread.sleep(2000L);
  Assert.assertFalse(queuePublisher.isConnected());
  queuePublisher.shutdown();
  queueThread.interrupt();
  queueThread.join();
}
origin: com.nesscomputing.components/ness-amqp

@Test
public void testSimpleConsumer() throws Exception
{
  final QueueConsumer queueConsumer = queueRunnableFactory.createQueueListener("test-queue", new DummyMessageCallback());
  Assert.assertNotNull(queueConsumer);
}
origin: com.nesscomputing.components/ness-amqp

final ExchangeConsumer topicConsumer1 = exchangeRunnableFactory.createExchangeListener("test-topic", cmc1);
final ExchangeConsumer topicConsumer2 = exchangeRunnableFactory.createExchangeListener("test-topic", cmc2);
final ExchangePublisher<Object> topicProducer = exchangeRunnableFactory.createExchangeJsonPublisher("test-topic");
final Thread consumerThread1 = new Thread(topicConsumer1);
final Thread consumerThread2 = new Thread(topicConsumer2);
origin: com.nesscomputing.components/ness-amqp

final QueueConsumer queueConsumer = queueRunnableFactory.createQueueListener("test-queue", cmc);
final QueuePublisher<Object> queuePublisher1 = queueRunnableFactory.createQueueJsonPublisher("test-queue");
final QueuePublisher<Object> queuePublisher2 = queueRunnableFactory.createQueueJsonPublisher("test-queue");
final Thread consumerThread = new Thread(queueConsumer);
final Thread producerThread1 = new Thread(queuePublisher1);
origin: com.nesscomputing.components/ness-amqp

@Test
public void stopProducerWithNoMessages() throws Exception
{
  final ExchangePublisher<Object>topicProducer = exchangeRunnableFactory.createExchangeJsonPublisher("test-topic");
  Assert.assertNotNull(topicProducer);
  final Thread topicThread = new Thread(topicProducer);
  topicThread.start();
  Thread.sleep(2000L);
  Assert.assertFalse(topicProducer.isConnected());
  topicProducer.shutdown();
  topicThread.interrupt();
  topicThread.join();
}
origin: com.nesscomputing.components/ness-amqp

@Test
public void testSimpleConsumer() throws Exception
{
  final ExchangeConsumer exchangeConsumer = exchangeRunnableFactory.createExchangeListener("test-topic", new DummyMessageCallback());
  Assert.assertNotNull(exchangeConsumer);
}
origin: com.nesscomputing.components/ness-amqp

final ExchangeConsumer topicConsumer = exchangeRunnableFactory.createExchangeListener("test-topic", cmc);
final ExchangePublisher<Object> topicProducer1 = exchangeRunnableFactory.createExchangeJsonPublisher("test-topic");
final ExchangePublisher<Object> topicProducer2 = exchangeRunnableFactory.createExchangeJsonPublisher("test-topic");
final Thread consumerThread = new Thread(topicConsumer);
final Thread producerThread1 = new Thread(topicProducer1);
origin: com.nesscomputing.components/ness-amqp

final QueueConsumer queueConsumer1 = queueRunnableFactory.createQueueListener("test-queue", cmc1);
final QueueConsumer queueConsumer2 = queueRunnableFactory.createQueueListener("test-queue", cmc2);
final QueuePublisher<Object> queuePublisher1 = queueRunnableFactory.createQueueJsonPublisher("test-queue");
final QueuePublisher<Object> queuePublisher2 = queueRunnableFactory.createQueueJsonPublisher("test-queue");
final Thread consumerThread1 = new Thread(queueConsumer1);
final Thread consumerThread2 = new Thread(queueConsumer2);
origin: com.nesscomputing.components/ness-amqp

final ExchangeConsumer topicConsumer = exchangeRunnableFactory.createExchangeListener("test-topic", callback);
final ExchangePublisher<Object> topicProducer = exchangeRunnableFactory.createExchangeJsonPublisher("test-topic");
final Thread consumerThread = new Thread(topicConsumer);
final Thread producerThread = new Thread(topicProducer);
origin: com.nesscomputing.components/ness-amqp

final ExchangeConsumer topicConsumer1 = exchangeRunnableFactory.createExchangeListener("test-topic", cmc1);
final ExchangeConsumer topicConsumer2 = exchangeRunnableFactory.createExchangeListener("test-topic", cmc2);
final ExchangePublisher<Object> topicProducer1 = exchangeRunnableFactory.createExchangeJsonPublisher("test-topic");
final ExchangePublisher<Object> topicProducer2 = exchangeRunnableFactory.createExchangeJsonPublisher("test-topic");
final Thread consumerThread1 = new Thread(topicConsumer1);
final Thread consumerThread2 = new Thread(topicConsumer2);
origin: com.nesscomputing.components/ness-amqp

final ExchangeConsumer topicConsumer = exchangeRunnableFactory.createExchangeListener("test-topic", callback);
final ExchangePublisher<Object> topicProducer = exchangeRunnableFactory.createExchangeJsonPublisher("test-topic");
final Thread consumerThread = new Thread(topicConsumer);
final Thread producerThread = new Thread(topicProducer);
com.nesscomputing.amqpAmqpRunnableFactory

Javadoc

Factory to create new Runnables to access exchanges and queues.

Most used methods

  • <init>
  • createExchangeJsonPublisher
    Creates a new ExchangePublisher. The Publisher accepts arbitrary objects and uses the Jackson object
  • createExchangeListener
    Creates a new ExchangeConsumer. For every message received (or when the timeout waiting for messages
  • createQueueJsonPublisher
    Creates a new QueuePublisher. The Publisher accepts arbitrary objects and uses the Jackson object ma
  • createQueueListener
    Creates a new QueueConsumer. For every message received (or when the timeout waiting for messages is

Popular in Java

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • setContentView (Activity)
  • setScale (BigDecimal)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Notification (javax.management)
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Top Vim 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