Search in sources :

Example 1 with GetSwitchesRequest

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

the class SwitchServiceImpl method getSwitches.

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

Aggregations

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