Search in sources :

Example 1 with GetSwitchRequest

use of org.openkilda.messaging.nbtopology.request.GetSwitchRequest in project open-kilda by telstra.

the class SwitchServiceImpl method getSwitch.

/**
 * {@inheritDoc}
 */
@Override
public CompletableFuture<SwitchDto> getSwitch(SwitchId switchId) {
    logger.debug("Get one switch request");
    CommandMessage request = new CommandMessage(new GetSwitchRequest(switchId), System.currentTimeMillis(), RequestCorrelationId.getId());
    return messagingChannel.sendAndGetChunked(nbworkerTopic, request).thenApply(messages -> messages.stream().map(GetSwitchResponse.class::cast).map(GetSwitchResponse::getPayload).map(switchMapper::toSwitchDto).collect(Collectors.toList()).get(0));
}
Also used : GetSwitchResponse(org.openkilda.messaging.nbtopology.response.GetSwitchResponse) GetSwitchRequest(org.openkilda.messaging.nbtopology.request.GetSwitchRequest) CommandMessage(org.openkilda.messaging.command.CommandMessage)

Aggregations

CommandMessage (org.openkilda.messaging.command.CommandMessage)1 GetSwitchRequest (org.openkilda.messaging.nbtopology.request.GetSwitchRequest)1 GetSwitchResponse (org.openkilda.messaging.nbtopology.response.GetSwitchResponse)1