当前位置: 首页>>代码示例>>Java>>正文


Java ActiveMQMessage.getDataStructure方法代码示例

本文整理汇总了Java中org.apache.activemq.command.ActiveMQMessage.getDataStructure方法的典型用法代码示例。如果您正苦于以下问题:Java ActiveMQMessage.getDataStructure方法的具体用法?Java ActiveMQMessage.getDataStructure怎么用?Java ActiveMQMessage.getDataStructure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.activemq.command.ActiveMQMessage的用法示例。


在下文中一共展示了ActiveMQMessage.getDataStructure方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onMessage

import org.apache.activemq.command.ActiveMQMessage; //导入方法依赖的package包/类
public void onMessage(Message message) {
    if (message instanceof ActiveMQMessage) {
        ActiveMQMessage activeMessage = (ActiveMQMessage)message;
        Object command = activeMessage.getDataStructure();
        int count = 0;
        if (command instanceof ProducerInfo) {
            count = producerCount.incrementAndGet();
            count = extractProducerCountFromMessage(message, count);
            fireProducerEvent(new ProducerStartedEvent(this, destination, (ProducerInfo)command, count));
        } else if (command instanceof RemoveInfo) {
            RemoveInfo removeInfo = (RemoveInfo)command;
            if (removeInfo.isProducerRemove()) {
                count = producerCount.decrementAndGet();
                count = extractProducerCountFromMessage(message, count);
                fireProducerEvent(new ProducerStoppedEvent(this, destination, (ProducerId)removeInfo.getObjectId(), count));
            }
        } else {
            LOG.warn("Unknown command: " + command);
        }
    } else {
        LOG.warn("Unknown message type: " + message + ". Message ignored");
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:24,代码来源:ProducerEventSource.java

示例2: onMessage

import org.apache.activemq.command.ActiveMQMessage; //导入方法依赖的package包/类
public void onMessage(Message message) {
    if (message instanceof ActiveMQMessage) {
        ActiveMQMessage activeMessage = (ActiveMQMessage)message;
        Object command = activeMessage.getDataStructure();
        int count = 0;
        if (command instanceof ConsumerInfo) {
            count = consumerCount.incrementAndGet();
            count = extractConsumerCountFromMessage(message, count);
            fireConsumerEvent(new ConsumerStartedEvent(this, destination, (ConsumerInfo)command, count));
        } else if (command instanceof RemoveInfo) {
            RemoveInfo removeInfo = (RemoveInfo)command;
            if (removeInfo.isConsumerRemove()) {
                count = consumerCount.decrementAndGet();
                count = extractConsumerCountFromMessage(message, count);
                fireConsumerEvent(new ConsumerStoppedEvent(this, destination, (ConsumerId)removeInfo.getObjectId(), count));
            }
        } else {
            LOG.warn("Unknown command: " + command);
        }
    } else {
        LOG.warn("Unknown message type: " + message + ". Message ignored");
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:24,代码来源:ConsumerEventSource.java

示例3: onMessage

import org.apache.activemq.command.ActiveMQMessage; //导入方法依赖的package包/类
public void onMessage(Message message) {
    if (message instanceof ActiveMQMessage) {
        ActiveMQMessage activeMessage = (ActiveMQMessage) message;
        Object command = activeMessage.getDataStructure();
        if (command instanceof DestinationInfo) {
            DestinationInfo destinationInfo = (DestinationInfo) command;
            DestinationEvent event = new DestinationEvent(this, destinationInfo);
            fireDestinationEvent(event);
        }
        else {
            LOG.warn("Unknown dataStructure: " + command);
        }
    }
    else {
        LOG.warn("Unknown message type: " + message + ". Message ignored");
    }
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:18,代码来源:DestinationSource.java

示例4: testTempMessageConsumedAdvisory

import org.apache.activemq.command.ActiveMQMessage; //导入方法依赖的package包/类
public void testTempMessageConsumedAdvisory() throws Exception {
   Session s = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
   TemporaryQueue queue = s.createTemporaryQueue();
   MessageConsumer consumer = s.createConsumer(queue);

   Topic advisoryTopic = AdvisorySupport.getMessageConsumedAdvisoryTopic((ActiveMQDestination) queue);
   MessageConsumer advisoryConsumer = s.createConsumer(advisoryTopic);
   //start throwing messages at the consumer
   MessageProducer producer = s.createProducer(queue);

   BytesMessage m = s.createBytesMessage();
   m.writeBytes(new byte[1024]);
   producer.send(m);
   String id = m.getJMSMessageID();
   Message msg = consumer.receive(1000);
   assertNotNull(msg);

   msg = advisoryConsumer.receive(1000);
   assertNotNull(msg);

   ActiveMQMessage message = (ActiveMQMessage) msg;
   ActiveMQMessage payload = (ActiveMQMessage) message.getDataStructure();
   String originalId = payload.getJMSMessageID();
   assertEquals(originalId, id);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:26,代码来源:AdvisoryTempDestinationTests.java

示例5: testMessageConsumedAdvisory

import org.apache.activemq.command.ActiveMQMessage; //导入方法依赖的package包/类
public void testMessageConsumedAdvisory() throws Exception {
   Session s = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
   Queue queue = s.createQueue(getClass().getName());
   MessageConsumer consumer = s.createConsumer(queue);

   Topic advisoryTopic = AdvisorySupport.getMessageConsumedAdvisoryTopic((ActiveMQDestination) queue);
   MessageConsumer advisoryConsumer = s.createConsumer(advisoryTopic);
   //start throwing messages at the consumer
   MessageProducer producer = s.createProducer(queue);

   BytesMessage m = s.createBytesMessage();
   m.writeBytes(new byte[1024]);
   producer.send(m);
   String id = m.getJMSMessageID();
   Message msg = consumer.receive(1000);
   assertNotNull(msg);

   msg = advisoryConsumer.receive(1000);
   assertNotNull(msg);

   ActiveMQMessage message = (ActiveMQMessage) msg;
   ActiveMQMessage payload = (ActiveMQMessage) message.getDataStructure();
   String originalId = payload.getJMSMessageID();
   assertEquals(originalId, id);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:26,代码来源:AdvisoryTests.java


注:本文中的org.apache.activemq.command.ActiveMQMessage.getDataStructure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。