List of usage examples for javax.jms StreamMessage writeObject
void writeObject(Object value) throws JMSException;
From source file:com.datatorrent.lib.io.jms.JMSObjectInputOperatorTest.java
private void createStreamMsgs(int numMessages) throws Exception { Long value = 1013L;//from w w w.ja va2s . co m StreamMessage message = testMeta.session.createStreamMessage(); message.writeObject(value); for (int i = 0; i < numMessages; i++) { testMeta.producer.send(message); } }
From source file:org.mule.transport.jms.JmsMessageUtils.java
private static Message listToMessage(List<?> value, Session session) throws JMSException { StreamMessage sMsg = session.createStreamMessage(); for (Iterator<?> iter = value.iterator(); iter.hasNext();) { Object o = iter.next();/* w ww. ja v a 2 s.c o m*/ if (validateStreamMessageType(o)) { sMsg.writeObject(o); } else { throw new MessageFormatException( String.format("Invalid type passed to StreamMessage: %s . Allowed types are: " + "Boolean, Byte, Short, Character, Integer, Long, Float, Double," + "String and byte[]", ClassUtils.getShortClassName(o, "null"))); } } return sMsg; }