use of org.opensmartgridplatform.shared.infra.jms.RequestMessage in project open-smart-grid-platform by OSGP.
the class PushNotificationSmsMessageProcessorTest method init.
@BeforeEach
public void init() throws JMSException {
final String correlationUid = "corr-uid-1";
final String organisationIdentification = "test-org";
final RequestMessage requestMessage = new RequestMessage(correlationUid, organisationIdentification, DEVICE_IDENTIFICATION, IP_ADDRESS, null, null, this.pushNotificationSms);
this.message = new ObjectMessageBuilder().withCorrelationUid(correlationUid).withMessageType(MessageType.PUSH_NOTIFICATION_SMS.name()).withDeviceIdentification(DEVICE_IDENTIFICATION).withObject(requestMessage).build();
}
use of org.opensmartgridplatform.shared.infra.jms.RequestMessage in project open-smart-grid-platform by OSGP.
the class EventNotificationMessageService method sendRequestMessageToDomainPublicLighting.
/**
* Send a request message to OSGP-ADAPTER-DOMAIN-PUBLICLIGHTING.
*/
private void sendRequestMessageToDomainPublicLighting(final String messageType, final String deviceIdentification, final Serializable dataObject) {
final String correlationUid = this.correlationIdProviderTimestampService.getCorrelationId(this.netmanagementOrganisation, deviceIdentification);
final RequestMessage message = new RequestMessage(correlationUid, this.netmanagementOrganisation, deviceIdentification, dataObject);
final DomainInfo domainInfo = this.eventNotificationHelperService.findDomainInfo(DomainTypeDto.PUBLIC_LIGHTING.name(), "1.0");
this.domainRequestService.send(message, messageType, domainInfo);
}
use of org.opensmartgridplatform.shared.infra.jms.RequestMessage in project open-smart-grid-platform by OSGP.
the class DeviceRegistrationMessageService method sendRequestMessageToDomainCore.
public void sendRequestMessageToDomainCore(final String deviceIdentification, final String organisationIdentification, final String correlationUid, final MessageType messageType) {
final RequestMessage message = new RequestMessage(correlationUid, organisationIdentification, deviceIdentification, null);
final DomainInfo domainInfo = this.domainInfoRepository.findByDomainAndDomainVersion("CORE", "1.0");
this.domainRequestService.send(message, messageType.name(), domainInfo);
}
use of org.opensmartgridplatform.shared.infra.jms.RequestMessage in project open-smart-grid-platform by OSGP.
the class Iec61850ChannelHandlerServer method processRegistrationMessage.
private void processRegistrationMessage(final RegisterDeviceRequest message, final String correlationId) {
this.logMessage(message);
final String deviceIdentification = message.getDeviceIdentification();
if (this.deviceRegistrationService.isKnownDevice(deviceIdentification)) {
LOGGER.info("Device {} found, start processing this registration message", deviceIdentification);
} else {
LOGGER.warn("Ignoring this registration message, because there's no device having identification {}", deviceIdentification);
return;
}
final IED ied = IED.FLEX_OVL;
final String ipAddress;
// set, the values will be used to set an IP address for a device.
if (this.testDeviceIps != null && this.testDeviceIps.containsKey(deviceIdentification)) {
final String testDeviceIp = this.testDeviceIps.get(deviceIdentification);
LOGGER.info("Using testDeviceId: {} and testDeviceIp: {}", deviceIdentification, testDeviceIp);
ipAddress = testDeviceIp;
} else {
ipAddress = message.getIpAddress();
}
final DeviceRegistrationDataDto deviceRegistrationData = new DeviceRegistrationDataDto(ipAddress, Ssld.SSLD_TYPE, true);
final RequestMessage requestMessage = new RequestMessage(correlationId, NO_ORGANISATION, deviceIdentification, ipAddress, null, null, deviceRegistrationData);
LOGGER.info("Sending register device request to OSGP with correlation ID: {}", correlationId);
this.osgpRequestMessageSender.send(requestMessage, MessageType.REGISTER_DEVICE.name());
try {
this.deviceRegistrationService.disableRegistration(deviceIdentification, InetAddress.getByName(ipAddress), ied, ied.getDescription());
final RequestMessage cdrRequestMessage = new RequestMessage(correlationId, NO_ORGANISATION, deviceIdentification, ipAddress);
this.osgpRequestMessageSender.send(cdrRequestMessage, MessageType.DEVICE_REGISTRATION_COMPLETED.name());
LOGGER.info("Disabled registration for device: {}, at IP address: {}", deviceIdentification, ipAddress);
} catch (final Exception e) {
LOGGER.error("Failed to disable registration for device: {}, at IP address: {}", deviceIdentification, ipAddress, e);
}
}
Aggregations