List of usage examples for javax.jms Session createObjectMessage
ObjectMessage createObjectMessage(Serializable object) throws JMSException;
From source file:ru.org.linux.search.SearchQueueSender.java
public void updateMessage(final int msgid, final boolean withComments) { logger.info("Scheduling reindex #" + msgid + " withComments=" + withComments); jmsTemplate.send(queue, new MessageCreator() { @Override/*from ww w.ja v a 2 s.c o m*/ public Message createMessage(Session session) throws JMSException { return session.createObjectMessage(new UpdateMessage(msgid, withComments)); } }); }
From source file:ru.org.linux.search.SearchQueueSender.java
public void updateMonth(final int year, final int month) { logger.info("Scheduling reindex by date " + year + '/' + month); jmsTemplate.send(queue, new MessageCreator() { @Override/* w ww.j a v a2 s . c om*/ public Message createMessage(Session session) throws JMSException { return session.createObjectMessage(new UpdateMonth(year, month)); } }); }
From source file:com.alliander.osgp.adapter.ws.smartmetering.infra.jms.SmartMeteringRequestMessageSender.java
/** * Method for sending a request message to the public lighting requests * queue/*from w ww . j a v a 2s .com*/ * * @param requestMessage * The SmartMeteringRequestMessage request message to send. */ private void sendMessage(final SmartMeteringRequestMessage requestMessage) { LOGGER.info("Sending message to the smart metering requests queue"); this.smartMeteringRequestsJmsTemplate.setPriority(requestMessage.getMessagePriority()); this.smartMeteringRequestsJmsTemplate.send(new MessageCreator() { @Override public Message createMessage(final Session session) throws JMSException { final ObjectMessage objectMessage = session.createObjectMessage(requestMessage.getRequest()); objectMessage.setJMSCorrelationID(requestMessage.getCorrelationUid()); objectMessage.setJMSType(requestMessage.getMessageType().toString()); objectMessage.setStringProperty(Constants.ORGANISATION_IDENTIFICATION, requestMessage.getOrganisationIdentification()); objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION, requestMessage.getDeviceIdentification()); if (requestMessage.getScheduleTime() != null) { objectMessage.setLongProperty(Constants.SCHEDULE_TIME, requestMessage.getScheduleTime()); } return objectMessage; } }); }
From source file:com.alliander.osgp.adapter.ws.core.infra.jms.CommonRequestMessageSender.java
/** * Method for sending a request message to the public lighting requests * queue//from ww w . java 2s . co m * * @param requestMessage * The CommonRequestMessage request message to send. */ private void sendMessage(final CommonRequestMessage requestMessage) { LOGGER.info("Sending request message to common requests queue"); this.commonRequestsJmsTemplate.send(new MessageCreator() { @Override public Message createMessage(final Session session) throws JMSException { final ObjectMessage objectMessage = session.createObjectMessage(requestMessage.getRequest()); objectMessage.setJMSCorrelationID(requestMessage.getCorrelationUid()); objectMessage.setJMSType(requestMessage.getMessageType().toString()); objectMessage.setStringProperty(Constants.ORGANISATION_IDENTIFICATION, requestMessage.getOrganisationIdentification()); objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION, requestMessage.getDeviceIdentification()); if (requestMessage.getScheduleTime() != null) { objectMessage.setLongProperty(Constants.SCHEDULE_TIME, requestMessage.getScheduleTime().getMillis()); } return objectMessage; } }); }
From source file:com.alliander.osgp.adapter.ws.publiclighting.infra.jms.PublicLightingRequestMessageSender.java
/** * Method for sending a request message to the public lighting requests * queue/*from ww w.j a v a 2 s . co m*/ * * @param requestMessage * The PublicLightingRequestMessage request message to send. */ private void sendMessage(final PublicLightingRequestMessage requestMessage) { LOGGER.info("Sending message to the public lighting requests queue"); this.publicLightingRequestsJmsTemplate.send(new MessageCreator() { @Override public Message createMessage(final Session session) throws JMSException { final ObjectMessage objectMessage = session.createObjectMessage(requestMessage.getRequest()); objectMessage.setJMSCorrelationID(requestMessage.getCorrelationUid()); objectMessage.setJMSType(requestMessage.getMessageType().toString()); objectMessage.setStringProperty(Constants.ORGANISATION_IDENTIFICATION, requestMessage.getOrganisationIdentification()); objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION, requestMessage.getDeviceIdentification()); if (requestMessage.getScheduleTime() != null) { objectMessage.setLongProperty(Constants.SCHEDULE_TIME, requestMessage.getScheduleTime().getMillis()); } return objectMessage; } }); }
From source file:com.alliander.osgp.adapter.ws.tariffswitching.infra.jms.TariffSwitchingRequestMessageSender.java
/** * Method for sending a request message to the public lighting requests * queue/* ww w .j a v a2 s . c o m*/ * * @param requestMessage * The TariffSwitchingRequestMessage request message to send. */ private void sendMessage(final TariffSwitchingRequestMessage requestMessage) { LOGGER.info("Sending message to the tariff switching requests queue"); this.tariffSwitchingRequestsJmsTemplate.send(new MessageCreator() { @Override public Message createMessage(final Session session) throws JMSException { final ObjectMessage objectMessage = session.createObjectMessage(requestMessage.getRequest()); objectMessage.setJMSCorrelationID(requestMessage.getCorrelationUid()); objectMessage.setJMSType(requestMessage.getMessageType().toString()); objectMessage.setStringProperty(Constants.ORGANISATION_IDENTIFICATION, requestMessage.getOrganisationIdentification()); objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION, requestMessage.getDeviceIdentification()); if (requestMessage.getScheduleTime() != null) { objectMessage.setLongProperty(Constants.SCHEDULE_TIME, requestMessage.getScheduleTime().getMillis()); } return objectMessage; } }); }
From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.messaging.DeviceResponseMessageSender.java
private void sendMessage(final ProtocolResponseMessage responseMessage) { this.iec61850ResponsesJmsTemplate.send(new MessageCreator() { @Override//from ww w . ja v a2 s . c o m public Message createMessage(final Session session) throws JMSException { final ObjectMessage objectMessage = session.createObjectMessage(responseMessage); objectMessage.setJMSCorrelationID(responseMessage.getCorrelationUid()); objectMessage.setStringProperty(Constants.DOMAIN, responseMessage.getDomain()); objectMessage.setStringProperty(Constants.DOMAIN_VERSION, responseMessage.getDomainVersion()); objectMessage.setJMSType(responseMessage.getMessageType()); objectMessage.setStringProperty(Constants.ORGANISATION_IDENTIFICATION, responseMessage.getOrganisationIdentification()); objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION, responseMessage.getDeviceIdentification()); objectMessage.setStringProperty(Constants.RESULT, responseMessage.getResult().toString()); if (responseMessage.getOsgpException() != null) { objectMessage.setStringProperty(Constants.DESCRIPTION, responseMessage.getOsgpException().getMessage()); } objectMessage.setBooleanProperty(Constants.IS_SCHEDULED, responseMessage.isScheduled()); objectMessage.setIntProperty(Constants.RETRY_COUNT, responseMessage.getRetryCount()); return objectMessage; } }); }
From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.DeviceResponseMessageSender.java
private void sendMessage(final ProtocolResponseMessage responseMessage) { this.oslpResponsesJmsTemplate.send(new MessageCreator() { @Override//w w w.ja v a2s . c o m public Message createMessage(final Session session) throws JMSException { final ObjectMessage objectMessage = session.createObjectMessage(responseMessage); objectMessage.setJMSCorrelationID(responseMessage.getCorrelationUid()); objectMessage.setStringProperty(Constants.DOMAIN, responseMessage.getDomain()); objectMessage.setStringProperty(Constants.DOMAIN_VERSION, responseMessage.getDomainVersion()); objectMessage.setJMSType(responseMessage.getMessageType()); objectMessage.setStringProperty(Constants.ORGANISATION_IDENTIFICATION, responseMessage.getOrganisationIdentification()); objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION, responseMessage.getDeviceIdentification()); objectMessage.setStringProperty(Constants.RESULT, responseMessage.getResult().toString()); if (responseMessage.getOsgpException() != null) { objectMessage.setStringProperty(Constants.DESCRIPTION, responseMessage.getOsgpException().getMessage()); } objectMessage.setBooleanProperty(Constants.IS_SCHEDULED, responseMessage.isScheduled()); objectMessage.setIntProperty(Constants.RETRY_COUNT, responseMessage.getRetryCount()); return objectMessage; } }); }
From source file:org.osgp.adapter.protocol.dlms.infra.messaging.DeviceResponseMessageSender.java
private void sendMessage(final ProtocolResponseMessage responseMessage) { this.dlmsResponsesJmsTemplate.setPriority(responseMessage.getMessagePriority()); this.dlmsResponsesJmsTemplate.send(new MessageCreator() { @Override//from www . j a v a 2 s .c om public Message createMessage(final Session session) throws JMSException { final ObjectMessage objectMessage = session.createObjectMessage(responseMessage); objectMessage.setJMSCorrelationID(responseMessage.getCorrelationUid()); objectMessage.setStringProperty(Constants.DOMAIN, responseMessage.getDomain()); objectMessage.setStringProperty(Constants.DOMAIN_VERSION, responseMessage.getDomainVersion()); objectMessage.setJMSType(responseMessage.getMessageType()); objectMessage.setStringProperty(Constants.ORGANISATION_IDENTIFICATION, responseMessage.getOrganisationIdentification()); objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION, responseMessage.getDeviceIdentification()); objectMessage.setStringProperty(Constants.RESULT, responseMessage.getResult().toString()); if (responseMessage.getOsgpException() != null) { objectMessage.setStringProperty(Constants.DESCRIPTION, responseMessage.getOsgpException().getMessage()); } objectMessage.setBooleanProperty(Constants.IS_SCHEDULED, responseMessage.isScheduled()); objectMessage.setIntProperty(Constants.RETRY_COUNT, responseMessage.getRetryCount()); return objectMessage; } }); }
From source file:org.fuin.auction.command.server.base.AuctionMessageProducer.java
/** * Publish a message to JMS./*from www . java 2 s. c o m*/ * * @param message * Message to publish. */ private void publish(final AuctionMessage message) { if (LOG.isDebugEnabled()) { LOG.debug("Publish to JMS: " + message.toTraceString()); } jmsTemplate.send(new MessageCreator() { @Override public final Message createMessage(final Session session) throws JMSException { return session.createObjectMessage(message); } }); }