Example usage for javax.jms ObjectMessage setJMSType

List of usage examples for javax.jms ObjectMessage setJMSType

Introduction

In this page you can find the example usage for javax.jms ObjectMessage setJMSType.

Prototype


void setJMSType(String type) throws JMSException;

Source Link

Document

Sets the message type.

Usage

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 . ja v a2s  . 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 . com
        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 w w . j a  v  a2 s  .  com*/
        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:com.alliander.osgp.adapter.protocol.iec61850.infra.messaging.OsgpRequestMessageSender.java

public void send(final RequestMessage requestMessage, final String messageType) {
    LOGGER.info("Sending request message to OSGP.");

    this.iec61850RequestsJmsTemplate.send(new MessageCreator() {

        @Override/*from  w ww  .j a  va 2 s  .co m*/
        public Message createMessage(final Session session) throws JMSException {
            final ObjectMessage objectMessage = session.createObjectMessage(requestMessage);
            objectMessage.setJMSType(messageType);
            objectMessage.setStringProperty(Constants.ORGANISATION_IDENTIFICATION,
                    requestMessage.getOrganisationIdentification());
            objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION,
                    requestMessage.getDeviceIdentification());

            return objectMessage;
        }

    });
}

From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.OsgpRequestMessageSender.java

public void send(final RequestMessage requestMessage, final String messageType) {
    LOGGER.info("Sending request message to OSGP.");

    this.osgpRequestsJmsTemplate.send(new MessageCreator() {

        @Override/*www .  j a va2s . c o  m*/
        public Message createMessage(final Session session) throws JMSException {
            final ObjectMessage objectMessage = session.createObjectMessage(requestMessage);
            objectMessage.setJMSType(messageType);
            objectMessage.setStringProperty(Constants.ORGANISATION_IDENTIFICATION,
                    requestMessage.getOrganisationIdentification());
            objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION,
                    requestMessage.getDeviceIdentification());

            return objectMessage;
        }

    });
}

From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.SigningServerRequestMessageSender.java

public void send(final RequestMessage requestMessage, final String messageType) {
    LOGGER.info("Sending request message to signing server, with reply-to-queue: {}.",
            this.replyToQueue.toString());

    this.signingServerRequestsJmsTemplate.send(new MessageCreator() {

        @Override//from  www .jav a2s. c o  m
        public Message createMessage(final Session session) throws JMSException {
            final ObjectMessage objectMessage = session.createObjectMessage(requestMessage);
            objectMessage.setJMSType(messageType);
            objectMessage.setJMSReplyTo(SigningServerRequestMessageSender.this.replyToQueue);
            objectMessage.setJMSCorrelationID(requestMessage.getCorrelationUid());
            objectMessage.setStringProperty(Constants.ORGANISATION_IDENTIFICATION,
                    requestMessage.getOrganisationIdentification());
            objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION,
                    requestMessage.getDeviceIdentification());

            return objectMessage;
        }

    });
}

From source file:org.osgp.adapter.protocol.dlms.infra.messaging.OsgpRequestMessageSender.java

public void send(final RequestMessage requestMessage, final String messageType) {
    LOGGER.info("Sending request message to OSGP.");

    this.osgpRequestsJmsTemplate.send(new MessageCreator() {

        @Override//from w w  w.  ja va  2s . c  o  m
        public Message createMessage(final Session session) throws JMSException {
            final ObjectMessage objectMessage = session.createObjectMessage(requestMessage);
            objectMessage.setJMSCorrelationID(requestMessage.getCorrelationUid());
            objectMessage.setJMSType(messageType);
            objectMessage.setStringProperty(Constants.ORGANISATION_IDENTIFICATION,
                    requestMessage.getOrganisationIdentification());
            objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION,
                    requestMessage.getDeviceIdentification());

            return objectMessage;
        }

    });
}

From source file:com.alliander.osgp.signing.server.infra.messaging.SigningServerResponseMessageSender.java

private void sendMessage(final ResponseMessage responseMessage, final String messageType,
        final Destination replyToQueue) {
    this.responsesJmsTemplate.send(replyToQueue, new MessageCreator() {
        @Override//from   ww  w  .  ja  v  a  2s.  c  o m
        public Message createMessage(final Session session) throws JMSException {
            final ObjectMessage objectMessage = session.createObjectMessage(responseMessage);
            objectMessage.setJMSCorrelationID(responseMessage.getCorrelationUid());
            objectMessage.setJMSType(messageType);
            objectMessage.setStringProperty(Constants.ORGANISATION_IDENTIFICATION,
                    responseMessage.getOrganisationIdentification());
            objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION,
                    responseMessage.getDeviceIdentification());
            if (responseMessage.getOsgpException() != null) {
                objectMessage.setStringProperty(Constants.DESCRIPTION,
                        responseMessage.getOsgpException().getMessage());
            }
            return objectMessage;
        }
    });
}

From source file:com.alliander.osgp.adapter.ws.admin.infra.jms.AdminRequestMessageSender.java

/**
 * Method for sending a request message to the admin requests queue
 *
 * @param requestMessage//from   w w w . ja v a  2s  . c om
 *            The CommonRequestMessage request message to send.
 */
private void sendMessage(final AdminRequestMessage requestMessage) {
    LOGGER.info("Sending request message to admin requests queue");

    this.adminRequestsJmsTemplate.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());
            return objectMessage;
        }

    });
}

From source file:com.alliander.osgp.adapter.ws.microgrids.infra.jms.MicrogridsRequestMessageSender.java

/**
 * Method for sending a request message to the microgrids requests queue
 *
 * @param requestMessage//from ww  w .ja va  2  s  .com
 *            The MicrogridsRequestMessage request message to send.
 */
private void sendMessage(final MicrogridsRequestMessage requestMessage) {
    LOGGER.info("Sending message to the microgrids requests queue");

    this.microgridsRequestsJmsTemplate.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());
            return objectMessage;
        }
    });
}