Search in sources :

Example 1 with RequestMessageMetadata

use of org.opensmartgridplatform.adapter.ws.smartmetering.endpoints.RequestMessageMetadata in project open-smart-grid-platform by OSGP.

the class RequestService method enqueueAndSendRequest.

public AsyncResponse enqueueAndSendRequest(final RequestMessageMetadata requestMessageMetadata, final Serializable requestData) throws FunctionalException {
    log.debug("{} called with organisation {} and device {}", requestMessageMetadata.getMessageType(), requestMessageMetadata.getOrganisationIdentification(), requestMessageMetadata.getDeviceIdentification());
    if (requestMessageMetadata.getDeviceFunction() != null) {
        this.checkAllowed(requestMessageMetadata.getOrganisationIdentification(), requestMessageMetadata.getDeviceIdentification(), requestMessageMetadata.getDeviceFunction());
    }
    final String correlationUid = this.correlationIdProviderService.getCorrelationId(requestMessageMetadata.getOrganisationIdentification(), requestMessageMetadata.getDeviceIdentification());
    final MessageMetadata messageMetadata = requestMessageMetadata.newMessageMetadata(correlationUid);
    final SmartMeteringRequestMessage message = SmartMeteringRequestMessage.newBuilder().messageMetadata(messageMetadata).request(requestData).build();
    this.smartMeteringRequestMessageSender.send(message);
    return this.createAsyncResponse(correlationUid, messageMetadata.getDeviceIdentification());
}
Also used : MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) RequestMessageMetadata(org.opensmartgridplatform.adapter.ws.smartmetering.endpoints.RequestMessageMetadata) SmartMeteringRequestMessage(org.opensmartgridplatform.adapter.ws.smartmetering.infra.jms.SmartMeteringRequestMessage)

Example 2 with RequestMessageMetadata

use of org.opensmartgridplatform.adapter.ws.smartmetering.endpoints.RequestMessageMetadata in project open-smart-grid-platform by OSGP.

the class ManagementService method enqueueAndSendFindLogsRequest.

public AsyncResponse enqueueAndSendFindLogsRequest(final RequestMessageMetadata requestMessageMetadata, final int pageNumber) throws FunctionalException {
    log.debug("{} called with organisation {} and device {}", requestMessageMetadata.getMessageType(), requestMessageMetadata.getOrganisationIdentification(), requestMessageMetadata.getDeviceIdentification());
    this.requestService.checkAllowed(requestMessageMetadata.getOrganisationIdentification(), requestMessageMetadata.getDeviceIdentification(), requestMessageMetadata.getDeviceFunction());
    final String correlationUid = this.correlationIdProviderService.getCorrelationId(requestMessageMetadata.getOrganisationIdentification(), requestMessageMetadata.getDeviceIdentification());
    final MessageMetadata deviceMessageMetadata = requestMessageMetadata.newMessageMetadata(correlationUid);
    this.findMessageLogsSyncRequestExecutor.execute(requestMessageMetadata.getOrganisationIdentification(), requestMessageMetadata.getDeviceIdentification(), correlationUid, pageNumber);
    return this.requestService.createAsyncResponse(correlationUid, deviceMessageMetadata.getDeviceIdentification());
}
Also used : MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) RequestMessageMetadata(org.opensmartgridplatform.adapter.ws.smartmetering.endpoints.RequestMessageMetadata)

Aggregations

RequestMessageMetadata (org.opensmartgridplatform.adapter.ws.smartmetering.endpoints.RequestMessageMetadata)2 MessageMetadata (org.opensmartgridplatform.shared.infra.jms.MessageMetadata)2 SmartMeteringRequestMessage (org.opensmartgridplatform.adapter.ws.smartmetering.infra.jms.SmartMeteringRequestMessage)1