當前位置: 首頁>>代碼示例>>Java>>正文


Java ActiveMQQueue類代碼示例

本文整理匯總了Java中org.apache.activemq.command.ActiveMQQueue的典型用法代碼示例。如果您正苦於以下問題:Java ActiveMQQueue類的具體用法?Java ActiveMQQueue怎麽用?Java ActiveMQQueue使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ActiveMQQueue類屬於org.apache.activemq.command包,在下文中一共展示了ActiveMQQueue類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: adminRequestJmsContainer

import org.apache.activemq.command.ActiveMQQueue; //導入依賴的package包/類
@Bean
public DefaultMessageListenerContainer adminRequestJmsContainer(ClientRequestDelegator delegator, ClientRequestErrorHandler errorHandler) {
  DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();

  String adminRequestQueue = properties.getJms().getAdminRequestQueue();
  container.setDestination(new ActiveMQQueue(adminRequestQueue));

  container.setConnectionFactory(adminSingleConnectionFactory());
  container.setMessageListener(delegator);
  container.setConcurrentConsumers(1);
  container.setMaxConcurrentConsumers(2);
  container.setMaxMessagesPerTask(1);
  container.setReceiveTimeout(1000);
  container.setIdleTaskExecutionLimit(600);
  container.setSessionTransacted(false);
  container.setTaskExecutor(clientExecutor);
  container.setErrorHandler(errorHandler);
  container.setAutoStartup(false);
  container.setPhase(ServerConstants.PHASE_INTERMEDIATE);
  return container;
}
 
開發者ID:c2mon,項目名稱:c2mon,代碼行數:22,代碼來源:AdminJmsConfig.java

示例2: taskMessageListenerContainer

import org.apache.activemq.command.ActiveMQQueue; //導入依賴的package包/類
@Bean
@Autowired
public DefaultMessageListenerContainer taskMessageListenerContainer(JmsExternalCommandListener externalTaskListener
        , ConnectionFactory connectionFactory
        , ActiveMQQueue taskQueue) {
    DefaultMessageListenerContainer listenerContainer = new DefaultMessageListenerContainer();
    listenerContainer.setMessageListener(externalTaskListener);
    listenerContainer.setDestination(taskQueue);
    listenerContainer.setConnectionFactory(connectionFactory);

    listenerContainer.setAcceptMessagesWhileStopping(false);
    listenerContainer.setSessionTransacted(true);
    listenerContainer.setConcurrentConsumers(concurrentConsumers);
    listenerContainer.setMaxMessagesPerTask(maxMessagesPerTask);
    listenerContainer.setReceiveTimeout(receiveTimeout);
    LOG.debug("DefaultMessageListenerContainer for queue [{}] with message selector [{}] was started", listenerContainer.getDestination(), listenerContainer.getMessageSelector());
    return listenerContainer;
}
 
開發者ID:EsikAntony,項目名稱:camunda-task-dispatcher,代碼行數:19,代碼來源:JmsExternalCommandListenerConfig.java

示例3: taskMessageListenerContainer

import org.apache.activemq.command.ActiveMQQueue; //導入依賴的package包/類
@Bean
@Autowired
public DefaultMessageListenerContainer taskMessageListenerContainer(JmsExternalTaskListener externalTaskListener
        , ConnectionFactory receiverConnectionFactory
        , ActiveMQQueue taskQueue) {
    DefaultMessageListenerContainer listenerContainer = new DefaultMessageListenerContainer();
    listenerContainer.setMessageListener(externalTaskListener);
    listenerContainer.setDestination(taskQueue);
    listenerContainer.setConnectionFactory(receiverConnectionFactory);

    listenerContainer.setAcceptMessagesWhileStopping(false);
    listenerContainer.setSessionTransacted(true);
    listenerContainer.setConcurrentConsumers(concurrentConsumers);
    listenerContainer.setMaxMessagesPerTask(maxMessagesPerTask);
    listenerContainer.setReceiveTimeout(receiveTimeout);
    return listenerContainer;
}
 
開發者ID:EsikAntony,項目名稱:camunda-task-dispatcher,代碼行數:18,代碼來源:JmsExternalTaskReceiverConfig.java

示例4: testExportQueuesPatternEmpty

import org.apache.activemq.command.ActiveMQQueue; //導入依賴的package包/類
@Test
public void testExportQueuesPatternEmpty() throws Exception {
    File sourceDir = storeFolder.newFolder();
    ActiveMQQueue queue = new ActiveMQQueue("test.queue");
    PersistenceAdapter adapter = getPersistenceAdapter(sourceDir);
    adapter.start();
    MessageStore messageStore = adapter.createQueueMessageStore(queue);
    messageStore.start();
    publishQueueMessages(messageStore, queue, new Date(), new byte[] {10, 11, 12});
    adapter.stop();

    File xmlFile = new File(storeFolder.getRoot().getAbsoluteFile(), "outputXml.xml");
    exportStore(ExportConfigurationBuilder.newBuilder()
            .setSource(sourceDir)
            .setTarget(xmlFile)
            .setQueuePattern("empty.>"));

    validate(xmlFile, 0);
}
 
開發者ID:apache,項目名稱:activemq-cli-tools,代碼行數:20,代碼來源:ExporterTest.java

示例5: clientRequestJmsContainer

import org.apache.activemq.command.ActiveMQQueue; //導入依賴的package包/類
@Bean
public DefaultMessageListenerContainer clientRequestJmsContainer(ClientRequestDelegator delegator, ClientRequestErrorHandler errorHandler) {
  DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();

  String clientRequestQueue = properties.getJms().getRequestQueue();
  container.setDestination(new ActiveMQQueue(clientRequestQueue));

  container.setConnectionFactory(clientSingleConnectionFactory());
  container.setMessageListener(delegator);
  container.setConcurrentConsumers(properties.getJms().getInitialConsumers());
  container.setMaxConcurrentConsumers(properties.getJms().getMaxConsumers());
  container.setMaxMessagesPerTask(1);
  container.setReceiveTimeout(1000);
  container.setIdleTaskExecutionLimit(600);
  container.setSessionTransacted(false);
  container.setTaskExecutor(clientExecutor());
  container.setErrorHandler(errorHandler);
  container.setAutoStartup(false);
  container.setPhase(ServerConstants.PHASE_INTERMEDIATE);
  return container;
}
 
開發者ID:c2mon,項目名稱:c2mon,代碼行數:22,代碼來源:ClientJmsConfig.java

示例6: configRequestJmsContainer

import org.apache.activemq.command.ActiveMQQueue; //導入依賴的package包/類
@Bean
public DefaultMessageListenerContainer configRequestJmsContainer(ConfigurationRequestHandler requestHandler) {
  DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();

  String configRequestQueue = properties.getJms().getConfigRequestQueue();
  container.setDestination(new ActiveMQQueue(configRequestQueue));

  container.setConnectionFactory(clientSingleConnectionFactory);
  container.setMessageListener(requestHandler);
  container.setConcurrentConsumers(1);
  container.setMaxConcurrentConsumers(1);
  container.setSessionTransacted(false);
  container.setTaskExecutor(clientExecutor);
  container.setPhase(ServerConstants.PHASE_START_LAST);
  return container;
}
 
開發者ID:c2mon,項目名稱:c2mon,代碼行數:17,代碼來源:ConfigRequestJmsConfig.java

示例7: subscribe

import org.apache.activemq.command.ActiveMQQueue; //導入依賴的package包/類
/**
 * Returns the container so that it can be started manually when added during
 * server runtime.
 * @param process the Process to create a container for
 * @param consumersMax the max number of consumers (at start-up subscribe with less)
 * @return the JMS container that was created
 */
private DefaultMessageListenerContainer subscribe(final Process process, final int consumersMax) {
  DefaultMessageListenerContainer container = new DefaultMessageListenerContainer();
  container.setConnectionFactory(updateConnectionFactory);
  container.setDestination(new ActiveMQQueue(properties.getJms().getQueuePrefix() + ".update." + process.getName()));
  container.setMessageListener(listener);
  container.setConcurrentConsumers(properties.getJms().getUpdate().getInitialConsumers());
  container.setMaxConcurrentConsumers(consumersMax);
  container.setSessionTransacted(properties.getJms().getUpdate().isTransacted());
  container.setCacheLevel(DefaultMessageListenerContainer.CACHE_CONSUMER);
  container.setAutoStartup(false);
  container.setPhase(ServerConstants.PHASE_START_LAST);
  container.setMaxMessagesPerTask(properties.getJms().getUpdate().getMaxMessagesPerTask());
  container.setReceiveTimeout(properties.getJms().getUpdate().getReceiveTimeout());
  container.setIdleTaskExecutionLimit(properties.getJms().getUpdate().getIdleTaskExecutionLimit());
  container.setBeanName(process.getName() + " update JMS container");
  container.setTaskExecutor(daqThreadPoolTaskExecutor);
  container.setAcceptMessagesWhileStopping(false);
  jmsContainers.put(process.getId(), container);
  container.initialize();
  return container;
}
 
開發者ID:c2mon,項目名稱:c2mon,代碼行數:29,代碼來源:JmsContainerManagerImpl.java

示例8: copyQueues

import org.apache.activemq.command.ActiveMQQueue; //導入依賴的package包/類
public void copyQueues(String filter) throws JMSException, InterruptedException {
    DestinationSource ds = sconn.getDestinationSource();
    Set<ActiveMQQueue> queues = ds.getQueues();
    
    for (ActiveMQQueue queue : queues) {
        System.out.println(queue.getQueueName());
        counter.set(0);
        try {
            copyQueue(queue);
        } catch (Exception e) {
            LOG.error("Error copying queue " + queue.getQueueName(), e);
        }
    }
    dconn.close();
    sconn.close();

}
 
開發者ID:cschneider,項目名稱:jms-copy,代碼行數:18,代碼來源:Copy.java

示例9: copyQueue

import org.apache.activemq.command.ActiveMQQueue; //導入依賴的package包/類
private void copyQueue(ActiveMQQueue queue) throws JMSException {
    Session ssess = sconn.createSession(false, Session.AUTO_ACKNOWLEDGE);
    Session dsess = dconn.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageConsumer consumer = ssess.createConsumer(queue);
    Queue destQueue = dsess.createQueue(queue.getQueueName());
    MessageProducer producer = dsess.createProducer(destQueue);
    Message message;
    while ((message = consumer.receive(100)) != null) {
        int c = counter.getAndIncrement();
        if (c % 10 == 0) {
            System.out.println("Queue: " + queue.getQueueName() + ". Move message " + c);
        }
        producer.send(destQueue, message);
    }
    producer.close();
    consumer.close();
    dsess.close();
    ssess.close();
}
 
開發者ID:cschneider,項目名稱:jms-copy,代碼行數:20,代碼來源:Copy.java

示例10: testManualRequestReply

import org.apache.activemq.command.ActiveMQQueue; //導入依賴的package包/類
@Test
public void testManualRequestReply() throws Exception {
    context.start();

    // send using pure JMS API to set a custom JMSReplyTo
    jms.send(new ActiveMQQueue("foo"), new MessageCreator() {
        public Message createMessage(Session session) throws JMSException {
            TextMessage msg = session.createTextMessage("Hello World");
            msg.setJMSReplyTo(new ActiveMQQueue("bar"));
            return msg;
        }
    });

    assertTrue(latch.await(5, TimeUnit.SECONDS));
    String reply = consumer.receiveBody(tempName, 5000, String.class);
    assertEquals("Bye World", reply);
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:18,代碼來源:JmsRequestReplyManualReplyTest.java

示例11: configureBroker

import org.apache.activemq.command.ActiveMQQueue; //導入依賴的package包/類
@Override
protected void configureBroker(BrokerService broker) throws Exception {
    broker.setUseJmx(true);
    broker.setPersistent(true);
    broker.setDataDirectory("target/activemq-data");
    broker.deleteAllMessages();
    broker.setAdvisorySupport(true);
    broker.addConnector(brokerUri);

    // configure expiration rate
    ActiveMQQueue queueName = new ActiveMQQueue(">");
    PolicyEntry entry = new PolicyEntry();
    entry.setDestination(queueName);
    entry.setExpireMessagesPeriod(1000);

    PolicyMap policyMap = new PolicyMap();
    policyMap.put(queueName, entry);
    broker.setDestinationPolicy(policyMap);
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:20,代碼來源:QueueProducerQoSTest.java

示例12: testDestiationSourceHasInitialDestinations

import org.apache.activemq.command.ActiveMQQueue; //導入依賴的package包/類
public void testDestiationSourceHasInitialDestinations() throws Exception {
   Thread.sleep(1000);

   DestinationSource destinationSource = connection.getDestinationSource();
   Set<ActiveMQQueue> queues = destinationSource.getQueues();
   Set<ActiveMQTopic> topics = destinationSource.getTopics();

   LOG.info("Queues: " + queues);
   LOG.info("Topics: " + topics);

   assertTrue("The queues should not be empty!", !queues.isEmpty());
   assertTrue("The topics should not be empty!", !topics.isEmpty());

   assertTrue("queues contains initial queue: " + queues, queues.contains(sampleQueue));
   assertTrue("topics contains initial topic: " + queues, topics.contains(sampleTopic));
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:17,代碼來源:DestinationListenerTest.java

示例13: getVirtualTopicConsumerDestinationFilter

import org.apache.activemq.command.ActiveMQQueue; //導入依賴的package包/類
private DestinationFilter getVirtualTopicConsumerDestinationFilter() {
    // created at startup, so no sync needed
    if (virtualConsumerDestinationFilter == null) {
        Set <ActiveMQQueue> consumerDestinations = new HashSet<ActiveMQQueue>();
        if (destinationInterceptors != null) {
            for (DestinationInterceptor interceptor : destinationInterceptors) {
                if (interceptor instanceof VirtualDestinationInterceptor) {
                    VirtualDestinationInterceptor virtualDestinationInterceptor = (VirtualDestinationInterceptor) interceptor;
                    for (VirtualDestination virtualDestination: virtualDestinationInterceptor.getVirtualDestinations()) {
                        if (virtualDestination instanceof VirtualTopic) {
                            consumerDestinations.add(new ActiveMQQueue(((VirtualTopic) virtualDestination).getPrefix() + DestinationFilter.ANY_DESCENDENT));
                        }
                    }
                }
            }
        }
        ActiveMQQueue filter = new ActiveMQQueue();
        filter.setCompositeDestinations(consumerDestinations.toArray(new ActiveMQDestination[]{}));
        virtualConsumerDestinationFilter = DestinationFilter.parseFilter(filter);
    }
    return virtualConsumerDestinationFilter;
}
 
開發者ID:DiamondLightSource,項目名稱:daq-eclipse,代碼行數:23,代碼來源:BrokerService.java

示例14: configureBroker

import org.apache.activemq.command.ActiveMQQueue; //導入依賴的package包/類
@Override
protected void configureBroker(BrokerService broker) throws Exception {
   super.configureBroker(broker);

   MultiKahaDBPersistenceAdapter mKahaDB = new MultiKahaDBPersistenceAdapter();
   List<FilteredKahaDBPersistenceAdapter> adapters = new LinkedList<>();
   FilteredKahaDBPersistenceAdapter defaultEntry = new FilteredKahaDBPersistenceAdapter();
   defaultEntry.setPersistenceAdapter(new LevelDBPersistenceAdapter());
   adapters.add(defaultEntry);

   FilteredKahaDBPersistenceAdapter special = new FilteredKahaDBPersistenceAdapter();
   special.setDestination(new ActiveMQQueue("special"));
   special.setPersistenceAdapter(new LevelDBPersistenceAdapter());
   adapters.add(special);

   mKahaDB.setFilteredPersistenceAdapters(adapters);
   broker.setPersistenceAdapter(mKahaDB);
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:19,代碼來源:mLevelDBXARecoveryBrokerTest.java

示例15: testAddingConsumer

import org.apache.activemq.command.ActiveMQQueue; //導入依賴的package包/類
public void testAddingConsumer() throws Exception {
   ActiveMQDestination destination = new ActiveMQQueue("TEST");

   // Setup a first connection
   connection.start();
   Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

   MessageProducer producer = session.createProducer(destination);
   //MessageConsumer consumer = session.createConsumer(destination);

   TextMessage message = session.createTextMessage("message");
   message.setStringProperty("JMSXGroupID", "TEST-GROUP");

   LOG.info("sending message: " + message);
   producer.send(message);

   MessageConsumer consumer = session.createConsumer(destination);

   TextMessage msg = (TextMessage) consumer.receive();
   assertNotNull(msg);
   boolean first = msg.getBooleanProperty("JMSXGroupFirstForConsumer");
   assertTrue(first);
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:24,代碼來源:MessageGroupTest.java


注:本文中的org.apache.activemq.command.ActiveMQQueue類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。