本文整理汇总了Java中org.apache.activemq.command.ActiveMQStreamMessage类的典型用法代码示例。如果您正苦于以下问题:Java ActiveMQStreamMessage类的具体用法?Java ActiveMQStreamMessage怎么用?Java ActiveMQStreamMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ActiveMQStreamMessage类属于org.apache.activemq.command包,在下文中一共展示了ActiveMQStreamMessage类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testStreamMessageCompression
import org.apache.activemq.command.ActiveMQStreamMessage; //导入依赖的package包/类
@Test
public void testStreamMessageCompression() throws Exception {
MessageConsumer consumer1 = remoteSession.createConsumer(included);
MessageProducer producer = localSession.createProducer(included);
producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
waitForConsumerRegistration(localBroker, 1, included);
StreamMessage test = localSession.createStreamMessage();
for (int i = 0; i < 100; ++i) {
test.writeString("test string: " + i);
}
producer.send(test);
Message msg = consumer1.receive(RECEIVE_TIMEOUT_MILLS);
assertNotNull(msg);
ActiveMQStreamMessage message = (ActiveMQStreamMessage) msg;
assertTrue(message.isCompressed());
for (int i = 0; i < 100; ++i) {
assertEquals("test string: " + i, message.readString());
}
}
示例2: transformToMap
import org.apache.activemq.command.ActiveMQStreamMessage; //导入依赖的package包/类
/**
* Transform an ActiveMQStreamMessage to a Map
*
* @param msg - stream message to transform
* @return map object
* @throws JMSException
*/
protected Map transformToMap(ActiveMQStreamMessage msg) throws JMSException {
Properties props = new Properties();
props.putAll(transformToMap((ActiveMQMessage)msg));
// Just set the toString of the message as the body of the stream
// message
props.setProperty(AmqMessagesUtil.JMS_MESSAGE_BODY_PREFIX + "JMSStreamMessage", getDisplayString(msg));
return props;
}
示例3: getTypeName
import org.apache.activemq.command.ActiveMQStreamMessage; //导入依赖的package包/类
@Override
protected String getTypeName() {
return ActiveMQStreamMessage.class.getName();
}
示例4: createStreamMessage
import org.apache.activemq.command.ActiveMQStreamMessage; //导入依赖的package包/类
@Override
public StreamMessage createStreamMessage() {
return new ActiveMQStreamMessage();
}
示例5: createObject
import org.apache.activemq.command.ActiveMQStreamMessage; //导入依赖的package包/类
/**
* @return a new object instance
*/
public DataStructure createObject() {
return new ActiveMQStreamMessage();
}
示例6: createObject
import org.apache.activemq.command.ActiveMQStreamMessage; //导入依赖的package包/类
@Override
public Object createObject() throws Exception {
ActiveMQStreamMessage info = new ActiveMQStreamMessage();
populateObject(info);
return info;
}
示例7: populateObject
import org.apache.activemq.command.ActiveMQStreamMessage; //导入依赖的package包/类
@Override
protected void populateObject(Object object) throws Exception {
super.populateObject(object);
ActiveMQStreamMessage info = (ActiveMQStreamMessage) object;
}
示例8: testTransformMessage
import org.apache.activemq.command.ActiveMQStreamMessage; //导入依赖的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);
}
示例9: createStreamMessage
import org.apache.activemq.command.ActiveMQStreamMessage; //导入依赖的package包/类
/**
* Creates a <CODE>StreamMessage</CODE> object. A
* <CODE>StreamMessage</CODE> object is used to send a self-defining
* stream of primitive values in the Java programming language.
*
* @return an ActiveMQStreamMessage
* @throws JMSException if the JMS provider fails to create this message due
* to some internal error.
*/
public StreamMessage createStreamMessage() throws JMSException {
ActiveMQStreamMessage message = new ActiveMQStreamMessage();
configureMessage(message);
return message;
}
示例10: getDataStructureType
import org.apache.activemq.command.ActiveMQStreamMessage; //导入依赖的package包/类
/**
* Return the type of Data Structure we marshal
* @return short representation of the type data structure
*/
public byte getDataStructureType() {
return ActiveMQStreamMessage.DATA_STRUCTURE_TYPE;
}