use of org.opensmartgridplatform.shared.infra.jms.RequestMessage in project open-smart-grid-platform by OSGP.
the class OsgpCoreRequestMessageSender method send.
private void send(final RequestMessage requestMessage, final String messageType, final int messagePriority, final String ipAddress, final Long scheduledTime, final Long delay) {
final String correlationUid = requestMessage.getCorrelationUid();
final String organisationIdentification = requestMessage.getOrganisationIdentification();
final String deviceIdentification = requestMessage.getDeviceIdentification();
this.jmsTemplate.send(new MessageCreator() {
@Override
public Message createMessage(final Session session) throws JMSException {
final ObjectMessage objectMessage = session.createObjectMessage();
objectMessage.setJMSType(messageType);
objectMessage.setJMSPriority(messagePriority);
objectMessage.setJMSCorrelationID(correlationUid);
objectMessage.setStringProperty(Constants.ORGANISATION_IDENTIFICATION, organisationIdentification);
objectMessage.setStringProperty(Constants.DEVICE_IDENTIFICATION, deviceIdentification);
objectMessage.setStringProperty(Constants.IP_ADDRESS, ipAddress);
if (scheduledTime != null) {
objectMessage.setLongProperty(Constants.SCHEDULE_TIME, scheduledTime);
}
if (delay != null) {
objectMessage.setLongProperty(ScheduledMessage.AMQ_SCHEDULED_DELAY, delay);
}
objectMessage.setObject(requestMessage.getRequest());
return objectMessage;
}
});
}
use of org.opensmartgridplatform.shared.infra.jms.RequestMessage in project open-smart-grid-platform by OSGP.
the class CommonRelayStatusUpdatedMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) throws JMSException {
MessageMetadata messageMetadata;
try {
messageMetadata = MessageMetadata.fromMessage(message);
} catch (final JMSException e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
return;
}
final RequestMessage requestMsg = new RequestMessage(messageMetadata.getCorrelationUid(), messageMetadata.getOrganisationIdentification(), messageMetadata.getDeviceIdentification(), null);
this.webServiceRequestMessageSender.send(requestMsg, messageMetadata.getMessageType());
}
use of org.opensmartgridplatform.shared.infra.jms.RequestMessage in project open-smart-grid-platform by OSGP.
the class DeviceManagementService method updateDeviceSslCertification.
@Transactional(value = "transactionManager")
public void updateDeviceSslCertification(final String organisationIdentification, final String deviceIdentification, final String correlationUid, final Certification certification, final String messageType, final int messagePriority) throws FunctionalException {
LOGGER.debug("UpdateDeviceSslCertification called with organisation {} and device {}", organisationIdentification, deviceIdentification);
this.findOrganisation(organisationIdentification);
final Device device = this.findActiveDevice(deviceIdentification);
if (certification == null) {
LOGGER.info("Certification is empty, skip sending a request to device");
return;
}
final org.opensmartgridplatform.dto.valueobjects.CertificationDto certificationDto = this.domainCoreMapper.map(certification, org.opensmartgridplatform.dto.valueobjects.CertificationDto.class);
this.osgpCoreRequestMessageSender.send(new RequestMessage(correlationUid, organisationIdentification, deviceIdentification, certificationDto), messageType, messagePriority, device.getIpAddress());
}
use of org.opensmartgridplatform.shared.infra.jms.RequestMessage in project open-smart-grid-platform by OSGP.
the class FirmwareManagementService method updateFirmware.
// === UPDATE FIRMWARE ===
public void updateFirmware(final CorrelationIds ids, final FirmwareUpdateMessageDataContainer firmwareUpdateMessageDataContainer, final Long scheduleTime, final String messageType, final int messagePriority) throws FunctionalException {
LOGGER.debug("Update firmware called with organisation [{}], device [{}], firmwareIdentification [{}].", ids.getOrganisationIdentification(), ids.getDeviceIdentification(), firmwareUpdateMessageDataContainer.getFirmwareUrl());
this.findOrganisation(ids.getOrganisationIdentification());
final Device device = this.findActiveDevice(ids.getDeviceIdentification());
if (device instanceof Ssld) {
this.createSsldPendingFirmwareUpdateRecord(ids, firmwareUpdateMessageDataContainer.getFirmwareUrl());
}
this.osgpCoreRequestMessageSender.sendWithScheduledTime(new RequestMessage(ids, this.domainCoreMapper.map(firmwareUpdateMessageDataContainer, org.opensmartgridplatform.dto.valueobjects.FirmwareUpdateMessageDataContainer.class)), messageType, messagePriority, device.getIpAddress(), scheduleTime);
}
use of org.opensmartgridplatform.shared.infra.jms.RequestMessage in project open-smart-grid-platform by OSGP.
the class FirmwareManagementService method getFirmwareVersion.
public void getFirmwareVersion(@Identification final String organisationIdentification, @Identification final String deviceIdentification, final String correlationUid, final String messageType, final int messagePriority, final Long delay) throws FunctionalException {
LOGGER.debug("Get firmware version called with organisation [{}], device [{}].", organisationIdentification, deviceIdentification);
this.findOrganisation(organisationIdentification);
final Device device = this.findActiveDevice(deviceIdentification);
this.osgpCoreRequestMessageSender.sendWithDelay(new RequestMessage(correlationUid, organisationIdentification, deviceIdentification, null), messageType, messagePriority, device.getIpAddress(), delay);
}
Aggregations