}
activeMessage = msg;
} else if (message instanceof ObjectMessage) {
ObjectMessage objMsg = (ObjectMessage) message;
ActiveMQObjectMessage msg = new ActiveMQObjectMessage();
msg.setConnection(connection);
msg.setObject(objMsg.getObject());
msg.storeContent();
activeMessage = msg;
} else if (message instanceof StreamMessage) {
StreamMessage streamMessage = (StreamMessage) message;
streamMessage.reset();
ActiveMQStreamMessage msg = new ActiveMQStreamMessage();
msg.setConnection(connection);
Object obj = null;
try {
while ((obj = streamMessage.readObject()) != null) {
msg.writeObject(obj);
}
} catch (MessageEOFException e) {
// if an end of message stream as expected
} catch (JMSException e) {
}
activeMessage = msg;
} else if (message instanceof TextMessage) {
TextMessage textMsg = (TextMessage) message;
ActiveMQTextMessage msg = new ActiveMQTextMessage();
msg.setConnection(connection);
msg.setText(textMsg.getText());
activeMessage = msg;
} else {
activeMessage = new ActiveMQMessage();
activeMessage.setConnection(connection);
}