List of usage examples for javax.jms ObjectMessage setStringProperty
void setStringProperty(String name, String value) throws JMSException;
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 www .ja va2 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 www. ja va 2 s .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.okj.commons.broker.SimpleMessagePublisher.java
/** * @see org.storevm.commons.broker.MessagePublisher#publishMessage(org.storevm.commons.broker.MessageEvent) *//*from w w w .j ava 2s . c o m*/ @Override public void publishMessage(MessageEvent event) { try { //1. ?? TopicPublisher publisher = this.session.createPublisher(this.topic); //2. ??? ObjectMessage message = session.createObjectMessage(event); //3. ?? message.setStringProperty(SERVER_ID, event.getAttribute(DEST_HOST)); message.setStringProperty(EVENT_CODE, event.getEventCode()); message.setStringProperty(TOPIC_NAME, topicName); //4. ??? publisher.publish(message); LogUtils.info(LOGGER, "???event={0}", event); } catch (JMSException ex) { LogUtils.error(LOGGER, "???", ex); } }
From source file:com.chakray.chilcano.wso2.rabbitmq.message.store.RabbitMQProducer.java
public boolean storeMessage(MessageContext synCtx) { if (synCtx == null) { return false; }/*from www .j a va2 s . c om*/ if (!checkConnection()) { logger.warn(getId() + ". Ignored MessageID : " + synCtx.getMessageID()); return false; } StorableMessage message = MessageConverter.toStorableMessage(synCtx); boolean error = false; Throwable throwable = null; try { ObjectMessage objectMessage = session.createObjectMessage(message); objectMessage.setStringProperty(OriginalMessageID, synCtx.getMessageID()); setPriority(producer, objectMessage, message); producer.send(objectMessage); } catch (JMSException e) { throwable = e; error = true; isConnectionError = true; } catch (Throwable t) { throwable = t; error = true; } if (error) { String errorMsg = getId() + ". Ignored MessageID : " + synCtx.getMessageID() + ". Could not store message to store [" + store.getName() + "]. Error:" + throwable.getLocalizedMessage(); logger.error(errorMsg, throwable); store.closeWriteConnection(); connection = null; if (logger.isDebugEnabled()) { logger.debug(getId() + ". Ignored MessageID : " + synCtx.getMessageID()); } return false; } else { store.cleanup(null, session, false); } if (logger.isDebugEnabled()) { logger.debug(getId() + ". Stored MessageID : " + synCtx.getMessageID()); } store.enqueued(); return true; }
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/* w w w.j a v a2 s . c om*/ 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.adapter.protocol.iec61850.infra.messaging.DeviceResponseMessageSender.java
private void sendMessage(final ProtocolResponseMessage responseMessage) { this.iec61850ResponsesJmsTemplate.send(new MessageCreator() { @Override/*w w w . j a va 2s . 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/*from ww w .ja v a 2 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: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 w w w . j a v a2 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: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 w w w. ja v a 2 s. 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 ww .ja v a2 s .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; } }); }