List of usage examples for javax.jms Session createObjectMessage
ObjectMessage createObjectMessage() throws JMSException;
From source file:biz.fstechnology.micro.server.jms.ResponseMessageCreator.java
/** * @see org.springframework.jms.core.MessageCreator#createMessage(javax.jms.Session) *//*from www. j av a2 s. co m*/ @Override public Message createMessage(Session session) throws JMSException { ObjectMessage message = session.createObjectMessage(); message.setObject(getContents()); message.setJMSCorrelationID(getRequestId()); return message; }
From source file:biz.fstechnology.micro.common.jms.RequestMessageCreator.java
/** * @see org.springframework.jms.core.MessageCreator#createMessage(javax.jms.Session) *//*w ww. java2s . c o m*/ @Override public Message createMessage(Session session) throws JMSException { ObjectMessage message = session.createObjectMessage(); message.setObject(getContents()); message.setJMSReplyTo(getReplyTo()); if (getRequestId() == null) { setRequestId(Double.toHexString(Math.random())); } message.setJMSCorrelationID(getRequestId()); return message; }
From source file:org.acruxsource.sandbox.spring.jmstows.jms.JmsMessageSender.java
public void sendMessage(String destination, final Serializable message) { jmsTemplate.send(destination, new MessageCreator() { @Override/* w w w .ja v a 2 s . com*/ public Message createMessage(Session session) throws JMSException { ObjectMessage objectMessage = session.createObjectMessage(); objectMessage.setObject(message); return objectMessage; } }); }
From source file:org.osgp.adapter.protocol.dlms.infra.messaging.DlmsLogItemRequestMessageSender.java
public void send(final DlmsLogItemRequestMessage dlmsLogItemRequestMessage) { LOGGER.debug("Sending DlmsLogItemRequestMessage"); this.dlmsLogItemRequestsJmsTemplate.send(new MessageCreator() { @Override//from w w w .j a v a2 s . c o m public Message createMessage(final Session session) throws JMSException { final ObjectMessage objectMessage = session.createObjectMessage(); objectMessage.setJMSType(Constants.DLMS_LOG_ITEM_REQUEST); objectMessage.setStringProperty(Constants.IS_INCOMING, dlmsLogItemRequestMessage.isIncoming().toString()); objectMessage.setStringProperty(Constants.ENCODED_MESSAGE, dlmsLogItemRequestMessage.getEncodedMessage()); objectMessage.setStringProperty(Constants.DECODED_MESSAGE, dlmsLogItemRequestMessage.getDecodedMessage()); objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION, dlmsLogItemRequestMessage.getDeviceIdentification()); objectMessage.setStringProperty(Constants.IS_VALID, dlmsLogItemRequestMessage.isValid().toString()); objectMessage.setIntProperty(Constants.PAYLOAD_MESSAGE_SERIALIZED_SIZE, dlmsLogItemRequestMessage.getPayloadMessageSerializedSize()); return objectMessage; } }); }
From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.messaging.Iec61850LogItemRequestMessageSender.java
public void send(final Iec61850LogItemRequestMessage iec61850LogItemRequestMessage) { LOGGER.debug("Sending Iec61850LogItemRequestMessage"); this.iec61850LogItemRequestsJmsTemplate.send(new MessageCreator() { @Override/*from w w w . j a va 2 s .c o m*/ public Message createMessage(final Session session) throws JMSException { final ObjectMessage objectMessage = session.createObjectMessage(); objectMessage.setJMSType(Constants.IEC61850_LOG_ITEM_REQUEST); objectMessage.setStringProperty(Constants.IS_INCOMING, iec61850LogItemRequestMessage.isIncoming().toString()); objectMessage.setStringProperty(Constants.ENCODED_MESSAGE, iec61850LogItemRequestMessage.getEncodedMessage()); objectMessage.setStringProperty(Constants.DECODED_MESSAGE, iec61850LogItemRequestMessage.getDecodedMessage()); objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION, iec61850LogItemRequestMessage.getDeviceIdentification()); objectMessage.setStringProperty(Constants.IS_VALID, iec61850LogItemRequestMessage.isValid().toString()); objectMessage.setIntProperty(Constants.PAYLOAD_MESSAGE_SERIALIZED_SIZE, iec61850LogItemRequestMessage.getPayloadMessageSerializedSize()); return objectMessage; } }); }
From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.OslpLogItemRequestMessageSender.java
public void send(final OslpLogItemRequestMessage oslpLogItemRequestMessage) { LOGGER.debug("Sending OslpLogItemRequestMessage"); this.oslpLogItemRequestsJmsTemplate.send(new MessageCreator() { @Override//from w ww . ja v a 2s.c o m public Message createMessage(final Session session) throws JMSException { final ObjectMessage objectMessage = session.createObjectMessage(); objectMessage.setJMSType(Constants.OSLP_LOG_ITEM_REQUEST); objectMessage.setStringProperty(Constants.IS_INCOMING, oslpLogItemRequestMessage.isIncoming().toString()); objectMessage.setStringProperty(Constants.DEVICE_UID, oslpLogItemRequestMessage.getDeviceUid()); objectMessage.setStringProperty(Constants.ENCODED_MESSAGE, oslpLogItemRequestMessage.getEncodedMessage()); objectMessage.setStringProperty(Constants.DECODED_MESSAGE, oslpLogItemRequestMessage.getDecodedMessage()); objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION, oslpLogItemRequestMessage.getDeviceIdentification()); objectMessage.setStringProperty(Constants.ORGANISATION_IDENTIFICATION, oslpLogItemRequestMessage.getOrganisationIdentification()); objectMessage.setStringProperty(Constants.IS_VALID, oslpLogItemRequestMessage.isValid().toString()); objectMessage.setIntProperty(Constants.PAYLOAD_MESSAGE_SERIALIZED_SIZE, oslpLogItemRequestMessage.getPayloadMessageSerializedSize()); return objectMessage; } }); }
From source file:org.yestech.publish.service.JmsQueuePublishProducer.java
@Override public void send(final IArtifact artifact) { jmsTemplate.send(queue, new MessageCreator() { public Message createMessage(Session session) throws JMSException { ObjectMessage message = session.createObjectMessage(); message.setObject(artifact); return message; }// ww w.j a v a 2s. c o m }); }
From source file:org.yestech.publish.service.JmsQueuePublishProducer.java
@Override public void send(final IFileArtifact artifact) { final File inputFile = artifact.getFile(); if (inputFile == null) { throw new RuntimeException("file can't be null for file artifact"); }// w w w. j a va2 s. c om reset(artifact); jmsTemplate.send(queue, new MessageCreator() { public Message createMessage(Session session) throws JMSException { ObjectMessage message = session.createObjectMessage(); message.setObject(artifact); message.setStringProperty(IPublishConstant.FILE_NAME, inputFile.getName()); message.setStringProperty(IPublishConstant.URL, url); return message; } }); }
From source file:com.clican.pluto.cluster.jms.SynchronizeServiceJmsImpl.java
public void synchronize(final Message msg) throws SynchronizeException { if (log.isDebugEnabled()) { log.debug("Send message [" + msg.toString() + "] to topic [" + msg.getName() + "]"); }//from w ww . j ava 2s. c o m Destination destination = destinationMap.get(msg.getName()); if (destination == null) { throw new SynchronizeException(msg); } try { jmsTemplate.send(destination, new MessageCreator() { public javax.jms.Message createMessage(Session session) throws JMSException { ObjectMessage om = session.createObjectMessage(); om.setObject(msg); return om; } }); } catch (JmsException e) { // If the <code>JmsException</code> is thrown, we have to invoke the // onException method to inform the SimpleConnectionFactory to // re-get // connection from newer ConnectionFactory which is injected as an // target. ConnectionFactory cf = jmsTemplate.getConnectionFactory(); if (cf instanceof ExceptionListener) { ((ExceptionListener) cf).onException(new JMSException(e.getMessage())); } try { jmsTemplate.send(destination, new MessageCreator() { public javax.jms.Message createMessage(Session session) throws JMSException { ObjectMessage om = session.createObjectMessage(); om.setObject(msg); return om; } }); } catch (JmsException ex) { throw new SynchronizeException(ex, msg); } } }
From source file:org.simbasecurity.core.event.EventService.java
private void publish(final SimbaEvent simbaEvent) { jmsTemplate.send(this.topic, new MessageCreator() { @Override/*from w w w . j ava 2s . com*/ public Message createMessage(Session session) throws JMSException { ObjectMessage message = session.createObjectMessage(); message.setObject(simbaEvent); return message; } }); }