use of org.opensmartgridplatform.shared.infra.jms.ResponseMessage in project open-smart-grid-platform by OSGP.
the class AdminRevokeKeyResponseMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) throws JMSException {
LOGGER.debug("Processing admin revoke key response message");
String correlationUid = null;
String messageType = null;
String organisationIdentification = null;
String deviceIdentification = null;
ResponseMessage responseMessage = null;
ResponseMessageResultType responseMessageResultType = null;
OsgpException osgpException = null;
try {
correlationUid = message.getJMSCorrelationID();
messageType = message.getJMSType();
organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION);
deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION);
responseMessage = (ResponseMessage) message.getObject();
responseMessageResultType = responseMessage.getResult();
osgpException = responseMessage.getOsgpException();
} catch (final JMSException e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
LOGGER.debug("correlationUid: {}", correlationUid);
LOGGER.debug("messageType: {}", messageType);
LOGGER.debug("organisationIdentification: {}", organisationIdentification);
LOGGER.debug("deviceIdentification: {}", deviceIdentification);
LOGGER.debug("responseMessageResultType: {}", responseMessageResultType);
LOGGER.debug("deviceIdentification: {}", deviceIdentification);
LOGGER.debug("osgpException", osgpException);
return;
}
try {
LOGGER.info("Calling application service function to handle response: {}", messageType);
this.deviceManagementService.handleRevokeKeyResponse(organisationIdentification, deviceIdentification, correlationUid, messageType, responseMessageResultType, osgpException);
} catch (final Exception e) {
this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, messageType, MessagePriorityEnum.DEFAULT.getPriority());
}
}
use of org.opensmartgridplatform.shared.infra.jms.ResponseMessage in project open-smart-grid-platform by OSGP.
the class ConfigurationService method handleGetMbusEncryptionKeyStatusByChannelResponse.
public void handleGetMbusEncryptionKeyStatusByChannelResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType resultType, final OsgpException exception, final GetMbusEncryptionKeyStatusByChannelResponseDto getMbusEncryptionKeyStatusByChannelResponseDto) {
log.info("handleGetMbusEncryptionKeyStatusByChannelResponse for MessageType: {}", messageMetadata.getMessageType());
final EncryptionKeyStatusType encryptionKeyStatusType = EncryptionKeyStatusType.valueOf(getMbusEncryptionKeyStatusByChannelResponseDto.getEncryptionKeyStatus().name());
final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(resultType).withOsgpException(exception).withDataObject(encryptionKeyStatusType).build();
this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}
use of org.opensmartgridplatform.shared.infra.jms.ResponseMessage in project open-smart-grid-platform by OSGP.
the class ConfigurationService method handleSetAdministrativeStatusResponse.
public void handleSetAdministrativeStatusResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) {
log.info("handleSetAdministrativeStatusResponse for MessageType: {}, with result: {}", messageMetadata.getMessageType(), deviceResult);
ResponseMessageResultType result = deviceResult;
if (exception != null) {
log.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception);
result = ResponseMessageResultType.NOT_OK;
}
final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(result).withOsgpException(exception).build();
this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}
use of org.opensmartgridplatform.shared.infra.jms.ResponseMessage in project open-smart-grid-platform by OSGP.
the class ConfigurationService method handleGetAdministrativeStatusResponse.
public void handleGetAdministrativeStatusResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType responseMessageResultType, final OsgpException osgpException, final AdministrativeStatusTypeDto administrativeStatusTypeDto) {
log.info("handleGetAdministrativeStatusResponse for MessageType: {}, with result: {}", messageMetadata.getMessageType(), responseMessageResultType);
ResponseMessageResultType result = responseMessageResultType;
if (osgpException != null) {
log.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, osgpException);
result = ResponseMessageResultType.NOT_OK;
}
final AdministrativeStatusType administrativeStatusType = this.configurationMapper.map(administrativeStatusTypeDto, AdministrativeStatusType.class);
final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(result).withOsgpException(osgpException).withDataObject(administrativeStatusType).build();
this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}
use of org.opensmartgridplatform.shared.infra.jms.ResponseMessage in project open-smart-grid-platform by OSGP.
the class InstallationService method handleResponse.
@Transactional(value = "transactionManager")
public void handleResponse(final String methodName, final MessageMetadata messageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) {
LOGGER.debug("{} for MessageType: {}", methodName, messageMetadata.getMessageType());
final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(this.getResponseMessageResultType(deviceResult, exception)).withOsgpException(exception).build();
this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}
Aggregations