use of javax.jms.JMSException in project Protocol-Adapter-OSLP by OSGP.
the class OsgpRequestMessageSender method send.
public void send(final RequestMessage requestMessage, final String messageType) {
LOGGER.info("Sending request message to OSGP.");
this.osgpRequestsJmsTemplate.send(new MessageCreator() {
@Override
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;
}
});
}
use of javax.jms.JMSException in project Protocol-Adapter-OSLP by OSGP.
the class SigningServerRequestMessageSender method send.
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
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;
}
});
}
use of javax.jms.JMSException in project Protocol-Adapter-OSLP by OSGP.
the class SigningServerResponsesMessageListener method onMessage.
@Override
public void onMessage(final Message message) {
try {
LOGGER.info("Received message of type: {}", message.getJMSType());
final ObjectMessage objectMessage = (ObjectMessage) message;
final String messageType = objectMessage.getJMSType();
final String correlationId = objectMessage.getJMSCorrelationID();
final String deviceIdentification = objectMessage.getStringProperty(Constants.DEVICE_IDENTIFICATION);
final ResponseMessage responseMessage = (ResponseMessage) objectMessage.getObject();
final ResponseMessageResultType result = responseMessage == null ? null : responseMessage.getResult();
// Check the result.
if (result.equals(ResponseMessageResultType.NOT_OK)) {
LOGGER.error("OslpEnvelope was not signed by signing-server. Unable to send request to device: {}", deviceIdentification);
this.oslpSigningService.handleError(deviceIdentification, responseMessage);
return;
}
LOGGER.info("messageType: {}, deviceIdentification: {}, result: {}, correlationId: {}", messageType, deviceIdentification, result, correlationId);
// Get the DTO object containing signed OslpEnvelope.
final SignedOslpEnvelopeDto signedOslpEnvelopeDto = (SignedOslpEnvelopeDto) responseMessage.getDataObject();
this.oslpSigningService.handleSignedOslpEnvelope(signedOslpEnvelopeDto, deviceIdentification);
} catch (final JMSException ex) {
LOGGER.error("Exception: {} ", ex.getMessage(), ex);
}
}
use of javax.jms.JMSException in project Protocol-Adapter-OSLP by OSGP.
the class CommonGetConfigurationRequestMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) {
LOGGER.debug("Processing common get configuration message");
String correlationUid = null;
String domain = null;
String domainVersion = null;
String messageType = null;
String organisationIdentification = null;
String deviceIdentification = null;
String ipAddress = null;
int retryCount = 0;
boolean isScheduled = false;
try {
correlationUid = message.getJMSCorrelationID();
domain = message.getStringProperty(Constants.DOMAIN);
domainVersion = message.getStringProperty(Constants.DOMAIN_VERSION);
messageType = message.getJMSType();
organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION);
deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION);
ipAddress = message.getStringProperty(Constants.IP_ADDRESS);
retryCount = message.getIntProperty(Constants.RETRY_COUNT);
isScheduled = message.propertyExists(Constants.IS_SCHEDULED) ? message.getBooleanProperty(Constants.IS_SCHEDULED) : false;
} catch (final JMSException e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
LOGGER.debug("correlationUid: {}", correlationUid);
LOGGER.debug("domain: {}", domain);
LOGGER.debug("domainVersion: {}", domainVersion);
LOGGER.debug("messageType: {}", messageType);
LOGGER.debug("organisationIdentification: {}", organisationIdentification);
LOGGER.debug("deviceIdentification: {}", deviceIdentification);
LOGGER.debug("ipAddress: {}", ipAddress);
return;
}
LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion);
final DeviceRequest deviceRequest = new DeviceRequest(organisationIdentification, deviceIdentification, correlationUid, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled);
this.deviceService.getConfiguration(deviceRequest);
}
use of javax.jms.JMSException in project Protocol-Adapter-OSLP by OSGP.
the class CommonGetFirmwareRequestMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) {
LOGGER.debug("Processing common get firmware request message");
String correlationUid = null;
String domain = null;
String domainVersion = null;
String messageType = null;
String organisationIdentification = null;
String deviceIdentification = null;
String ipAddress = null;
int retryCount = 0;
boolean isScheduled = false;
try {
correlationUid = message.getJMSCorrelationID();
domain = message.getStringProperty(Constants.DOMAIN);
domainVersion = message.getStringProperty(Constants.DOMAIN_VERSION);
messageType = message.getJMSType();
organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION);
deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION);
ipAddress = message.getStringProperty(Constants.IP_ADDRESS);
retryCount = message.getIntProperty(Constants.RETRY_COUNT);
isScheduled = message.propertyExists(Constants.IS_SCHEDULED) ? message.getBooleanProperty(Constants.IS_SCHEDULED) : false;
} catch (final JMSException e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
LOGGER.debug("correlationUid: {}", correlationUid);
LOGGER.debug("domain: {}", domain);
LOGGER.debug("domainVersion: {}", domainVersion);
LOGGER.debug("messageType: {}", messageType);
LOGGER.debug("organisationIdentification: {}", organisationIdentification);
LOGGER.debug("deviceIdentification: {}", deviceIdentification);
LOGGER.debug("ipAddress: {}", ipAddress);
return;
}
LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion);
final DeviceRequest deviceRequest = new DeviceRequest(organisationIdentification, deviceIdentification, correlationUid, domain, domainVersion, messageType, ipAddress, retryCount, isScheduled);
this.deviceService.getFirmwareVersion(deviceRequest);
}
Aggregations