• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ActiveMQObjectMessage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ActiveMQObjectMessage类属于org.apache.activemq.command包,在下文中一共展示了ActiveMQObjectMessage类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getTypeName

import org.apache.activemq.command.ActiveMQObjectMessage; //导入依赖的package包/类
@Override
protected String getTypeName() {
    return ActiveMQObjectMessage.class.getName();
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:5,代码来源:OpenTypeSupport.java


示例2: fromHeaders

import org.apache.activemq.command.ActiveMQObjectMessage; //导入依赖的package包/类
/**
 * {@inheritDoc}. Additionally sets <code>AMQ_SCHEDULED_DELAY</code> using
 * <code>MotechEventConfig</code> variables.
 */
@Override
public void fromHeaders(MessageHeaders messageHeaders, Message message) {
    super.fromHeaders(messageHeaders, message);
    try {
        MotechEvent motechEvent = (MotechEvent) ((ActiveMQObjectMessage) message).getObject();

        if (motechEvent.isInvalid()) {
            long redeliveryCount = motechEvent.getMessageRedeliveryCount();
            Double delay = motechEventConfig.getMessageRedeliveryDelay() * MILLIS_PER_SEC *
                    ((Math.pow(2, redeliveryCount - 1)));
            LOGGER.debug("Redelivering " + motechEvent + " after " + delay + " millis.");
            message.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, delay.longValue());
        }
    } catch (JMSException e) {
        LOGGER.error("Failed to set header", e);
    }
}
 
开发者ID:motech,项目名称:motech,代码行数:22,代码来源:MotechEventHeaderMapper.java


示例3: testObjectMessageCompression

import org.apache.activemq.command.ActiveMQObjectMessage; //导入依赖的package包/类
@Test
public void testObjectMessageCompression() throws Exception {

   MessageConsumer consumer1 = remoteSession.createConsumer(included);
   MessageProducer producer = localSession.createProducer(included);
   producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

   waitForConsumerRegistration(localBroker, 1, included);

   StringBuilder payload = new StringBuilder("test-");
   for (int i = 0; i < 100; ++i) {
      payload.append(UUID.randomUUID().toString());
   }

   Message test = localSession.createObjectMessage(payload.toString());
   producer.send(test);
   Message msg = consumer1.receive(RECEIVE_TIMEOUT_MILLS);
   assertNotNull(msg);
   ActiveMQObjectMessage message = (ActiveMQObjectMessage) msg;
   assertTrue(message.isCompressed());
   assertEquals(payload.toString(), message.getObject());
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:23,代码来源:CompressionOverNetworkTest.java


示例4: getMessagesFromBroker

import org.apache.activemq.command.ActiveMQObjectMessage; //导入依赖的package包/类
protected List<Object[]> getMessagesFromBroker() throws JMSException {
    List<Object[]> messages = new ArrayList<Object[]>();
    Message message = new ActiveMQMessage();
    while (message != null) {
        message = messageConsumer.receive(1000);
        if (message == null) {
            break;
        }

        Serializable obj = ((ActiveMQObjectMessage)message).getObject();
        if (obj != null && obj instanceof Object[]) {
            messages.add((Object[])obj);
        }
    }

    return messages;
}
 
开发者ID:garethahealy,项目名称:jboss-fuse-examples,代码行数:18,代码来源:BaseBroker.java


示例5: onMessage

import org.apache.activemq.command.ActiveMQObjectMessage; //导入依赖的package包/类
@Override
public void onMessage(Message message) {
    //TODO add transactional logic here with txn manager

    if (message instanceof ObjectMessage) {
        ServiceRequest serviceRequest = null;
        try {
            ActiveMQObjectMessage msg = (ActiveMQObjectMessage) message;
            serviceRequest = (ServiceRequest) msg.getObject();
            ServiceRequestType serviceRequestType = serviceRequest.getRequestType();
            //Process the json
            serviceRequestType.process(serviceRequest);
        } catch (Exception e) {
            LOG.error("Error processing json: " + (serviceRequest==null?"":serviceRequest.getJson()), e);

            //TODO respond back to client using the request id or set the status of the request id to failure

            //TODO Handle poison messages
        }
    }
}
 
开发者ID:fizalihsan,项目名称:Fig,代码行数:22,代码来源:ServiceRequestConsumer.java


示例6: toMessage

import org.apache.activemq.command.ActiveMQObjectMessage; //导入依赖的package包/类
public Message toMessage(Object obj, Session session) throws JMSException,
			MessageConversionException {

		if (obj instanceof InvokeMessage) {
			ActiveMQObjectMessage objMsg = (ActiveMQObjectMessage) session
					.createObjectMessage();
			long delay=5*1000;
        	System.out.println("延时:"+delay/1000+"秒");
        	System.out.println("msgId:"+objMsg.getJMSMessageID());
        	objMsg.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, delay);
//        	objMsg.setExpiration(2000);
        	
			Map<String, byte[]> map = new HashMap<String, byte[]>();
			try {
				ByteArrayOutputStream bos = new ByteArrayOutputStream();
				ObjectOutputStream oos = new ObjectOutputStream(bos);
				oos.writeObject(obj);
				map.put("InvokeMessage", bos.toByteArray());
			} catch (IOException e) {
				e.printStackTrace();
			}
			objMsg.setObjectProperty("Map", map);
			return objMsg;
		} else {
			throw new JMSException("Object:[" + obj + "] is not InvokeMessage");
		}
	}
 
开发者ID:wkeyuan,项目名称:DWSurvey,代码行数:28,代码来源:InvokeMessageConverter.java


示例7: transformToMap

import org.apache.activemq.command.ActiveMQObjectMessage; //导入依赖的package包/类
/**
 * Transform an ActiveMQMessage to a Map
 * 
 * @param msg - object message to transform
 * @return map object
 * @throws JMSException
 */
protected Map transformToMap(ActiveMQObjectMessage msg) throws JMSException {
    Properties props = new Properties();

    props.putAll(transformToMap((ActiveMQMessage)msg));
    if (msg.getObject() != null) {
        // Just add the class name and toString value of the object
        props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + "JMSObjectClass", msg.getObject().getClass().getName());
        props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + "JMSObjectString", getDisplayString(msg.getObject()));
    }
    return props;
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:19,代码来源:MapTransformFilter.java


示例8: onMessage

import org.apache.activemq.command.ActiveMQObjectMessage; //导入依赖的package包/类
public void onMessage(Message message) {
	try {
		// receive log event in your consumer
		LoggingEvent event = (LoggingEvent)((ActiveMQObjectMessage)message).getObject();
		System.out.println("Received log [" + event.getLevel() + "]: "+ event.getMessage());
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
开发者ID:chipster,项目名称:chipster,代码行数:10,代码来源:Log4jJMSAppenderExample.java


示例9: setObjectPayload

import org.apache.activemq.command.ActiveMQObjectMessage; //导入依赖的package包/类
@Override
public void setObjectPayload(ObjectMessage msg, byte[] rawPayload) throws JMSException {
    ((ActiveMQObjectMessage) msg).setContent(new ByteSequence(rawPayload));
}
 
开发者ID:erik-wramner,项目名称:JmsTools,代码行数:5,代码来源:AmqObjectMessageAdapter.java


示例10: getObjectPayload

import org.apache.activemq.command.ActiveMQObjectMessage; //导入依赖的package包/类
@Override
public byte[] getObjectPayload(ObjectMessage msg) throws JMSException {
    return ((ActiveMQObjectMessage) msg).getContent().getData();
}
 
开发者ID:erik-wramner,项目名称:JmsTools,代码行数:5,代码来源:AmqObjectMessageAdapter.java


示例11: createObjectMessage

import org.apache.activemq.command.ActiveMQObjectMessage; //导入依赖的package包/类
protected ActiveMQObjectMessage createObjectMessage(HierarchicalStreamReader in) throws JMSException {
    ActiveMQObjectMessage objMsg = new ActiveMQObjectMessage();
    Object obj = getXStream().unmarshal(in);
    objMsg.setObject((Serializable) obj);
    return objMsg;
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:7,代码来源:JmsFrameTranslator.java


示例12: createObjectMessage

import org.apache.activemq.command.ActiveMQObjectMessage; //导入依赖的package包/类
@Override
public ObjectMessage createObjectMessage() {
    return new ActiveMQObjectMessage();
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:5,代码来源:ActiveMQJMSVendor.java


示例13: createObject

import org.apache.activemq.command.ActiveMQObjectMessage; //导入依赖的package包/类
/**
 * @return a new object instance
 */
public DataStructure createObject() {
    return new ActiveMQObjectMessage();
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:7,代码来源:ActiveMQObjectMessageMarshaller.java


示例14: createObject

import org.apache.activemq.command.ActiveMQObjectMessage; //导入依赖的package包/类
@Override
public Object createObject() throws Exception {
   ActiveMQObjectMessage info = new ActiveMQObjectMessage();
   populateObject(info);
   return info;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:7,代码来源:ActiveMQObjectMessageTest.java


示例15: populateObject

import org.apache.activemq.command.ActiveMQObjectMessage; //导入依赖的package包/类
@Override
protected void populateObject(Object object) throws Exception {
   super.populateObject(object);
   ActiveMQObjectMessage info = (ActiveMQObjectMessage) object;

}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:7,代码来源:ActiveMQObjectMessageTest.java


示例16: getNextPccMessage

import org.apache.activemq.command.ActiveMQObjectMessage; //导入依赖的package包/类
@Override
public ObjectMessage getNextPccMessage() {
    return new ActiveMQObjectMessage();
}
 
开发者ID:dpisarenko,项目名称:pcc-worker,代码行数:5,代码来源:MockChannel.java


示例17: createObjectMessage

import org.apache.activemq.command.ActiveMQObjectMessage; //导入依赖的package包/类
/**
 * Creates an initialized <CODE>ObjectMessage</CODE> object. An
 * <CODE>ObjectMessage</CODE> object is used to send a message that
 * contains a serializable Java object.
 *
 * @param object the object to use to initialize this message
 * @return an ActiveMQObjectMessage
 * @throws JMSException if the JMS provider fails to create this message due
 *                 to some internal error.
 */
public ObjectMessage createObjectMessage(Serializable object) throws JMSException {
    ActiveMQObjectMessage message = new ActiveMQObjectMessage();
    configureMessage(message);
    message.setObject(object);
    return message;
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:17,代码来源:ActiveMQSession.java


示例18: testTransformMessage

import org.apache.activemq.command.ActiveMQObjectMessage; //导入依赖的package包/类
/**
 * Tests transforming messages into ActiveMQ's message implementation.
 */
public void testTransformMessage() throws Exception {
   assertTrue("Transforming a BytesMessage message into an ActiveMQBytesMessage", ActiveMQMessageTransformation.transformMessage(new ActiveMQBytesMessage(), null) instanceof ActiveMQBytesMessage);

   assertTrue("Transforming a MapMessage message to an ActiveMQMapMessage", ActiveMQMessageTransformation.transformMessage(new ActiveMQMapMessage(), null) instanceof ActiveMQMapMessage);

   assertTrue("Transforming an ObjectMessage message to an ActiveMQObjectMessage", ActiveMQMessageTransformation.transformMessage(new ActiveMQObjectMessage(), null) instanceof ActiveMQObjectMessage);

   assertTrue("Transforming a StreamMessage message to an ActiveMQStreamMessage", ActiveMQMessageTransformation.transformMessage(new ActiveMQStreamMessage(), null) instanceof ActiveMQStreamMessage);

   assertTrue("Transforming a TextMessage message to an ActiveMQTextMessage", ActiveMQMessageTransformation.transformMessage(new ActiveMQTextMessage(), null) instanceof ActiveMQTextMessage);

   assertTrue("Transforming an ActiveMQMessage message to an ActiveMQMessage", ActiveMQMessageTransformation.transformMessage(new ActiveMQMessage(), null) instanceof ActiveMQMessage);
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:17,代码来源:MessageTransformationTest.java


示例19: getDataStructureType

import org.apache.activemq.command.ActiveMQObjectMessage; //导入依赖的package包/类
/**
 * Return the type of Data Structure we marshal
 * @return short representation of the type data structure
 */
public byte getDataStructureType() {
    return ActiveMQObjectMessage.DATA_STRUCTURE_TYPE;
}
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:8,代码来源:ActiveMQObjectMessageMarshaller.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Decoder类代码示例发布时间:2022-05-22
下一篇:
Java EmptyGraph类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap