use of org.opensmartgridplatform.shared.infra.jms.RequestMessage in project open-smart-grid-platform by OSGP.
the class CommunicationRecoveryService method restoreCommunication.
public void restoreCommunication(final RtuDevice rtu) {
LOGGER.info("Restoring communication for device {}.", rtu.getDeviceIdentification());
if (rtu.getOwner() == null) {
LOGGER.warn("Device {} has no owner. Skipping communication recovery.", rtu.getDeviceIdentification());
return;
}
final RequestMessage message = this.createMessage(rtu);
this.osgpCoreRequestMessageSender.send(message, DeviceFunction.GET_DATA.toString(), rtu.getIpAddress());
}
use of org.opensmartgridplatform.shared.infra.jms.RequestMessage in project open-smart-grid-platform by OSGP.
the class MonitoringService method getPQValues.
public void getPQValues(final CorrelationIds ids, final String messageType, final GetPQValuesRequest getPQValuesRequest) throws FunctionalException {
LOGGER.info("Get PQ Values for device [{}] with correlation id [{}]", ids.getDeviceIdentification(), ids.getCorrelationUid());
this.findOrganisation(ids.getOrganisationIdentification());
final Device device = this.findActiveDevice(ids.getDeviceIdentification());
final GetPQValuesRequestDto dto = this.mapper.map(getPQValuesRequest, GetPQValuesRequestDto.class);
this.osgpCoreRequestMessageSender.send(new RequestMessage(ids, dto), messageType, device.getIpAddress());
}
use of org.opensmartgridplatform.shared.infra.jms.RequestMessage in project open-smart-grid-platform by OSGP.
the class DeviceManagementService method revokeKey.
// === REVOKE KEY ===
public void revokeKey(final String organisationIdentification, @Identification final String deviceIdentification, final String correlationUid, final String messageType) throws FunctionalException {
LOGGER.info("MessageType: {}. Revoking key for device [{}] on behalf of organisation [{}]", messageType, deviceIdentification, organisationIdentification);
try {
this.organisationDomainService.searchOrganisation(organisationIdentification);
} catch (final UnknownEntityException e) {
throw new FunctionalException(FunctionalExceptionType.UNKNOWN_ORGANISATION, ComponentType.DOMAIN_ADMIN, e);
}
this.osgpCoreRequestMessageSender.send(new RequestMessage(correlationUid, organisationIdentification, deviceIdentification, null), messageType, null);
}
use of org.opensmartgridplatform.shared.infra.jms.RequestMessage in project open-smart-grid-platform by OSGP.
the class OsgpCoreRequestMessageListener method onMessage.
@Override
public void onMessage(final Message message) {
try {
LOGGER.info("Received message");
final ObjectMessage objectMessage = (ObjectMessage) message;
final String messageType = objectMessage.getJMSType();
final RequestMessage requestMessage = (RequestMessage) objectMessage.getObject();
this.messageProcessor.processMessage(requestMessage, messageType);
} catch (final JMSException e) {
// Can't read message.
LOGGER.error("Exception: {}, StackTrace: {}", e.getMessage(), e.getStackTrace(), e);
} catch (final UnknownMessageTypeException e) {
// Don't know this message.
LOGGER.error("UnknownMessageTypeException", e);
}
}
use of org.opensmartgridplatform.shared.infra.jms.RequestMessage in project open-smart-grid-platform by OSGP.
the class AdHocManagementService method handleSetDataRequest.
// === SET DATA ===
public void handleSetDataRequest(final String organisationIdentification, final String deviceIdentification, final String correlationUid, final String messageType, final SetDataRequest setDataRequest) throws FunctionalException {
LOGGER.info("Set data for device [{}] with correlation id [{}]", deviceIdentification, correlationUid);
this.findOrganisation(organisationIdentification);
final Device device = this.findActiveDevice(deviceIdentification);
final SetDataRequestDto dto = this.mapper.map(setDataRequest, SetDataRequestDto.class);
this.osgpCoreRequestMessageSender.send(new RequestMessage(correlationUid, organisationIdentification, deviceIdentification, dto), messageType, device.getIpAddress());
}
Aggregations