use of org.openkilda.messaging.Message in project open-kilda by telstra.
the class FlowServiceImpl method statusFlow.
/**
* {@inheritDoc}
*/
@Override
public FlowIdStatusPayload statusFlow(final String id, final String correlationId) {
LOGGER.debug("Flow status: {}={}", CORRELATION_ID, correlationId);
FlowStatusRequest data = new FlowStatusRequest(new FlowIdStatusPayload(id, null));
CommandMessage request = new CommandMessage(data, System.currentTimeMillis(), correlationId, Destination.WFM);
messageConsumer.clear();
messageProducer.send(topic, request);
Message message = (Message) messageConsumer.poll(correlationId);
FlowStatusResponse response = (FlowStatusResponse) validateInfoMessage(request, message, correlationId);
return response.getPayload();
}
use of org.openkilda.messaging.Message in project open-kilda by telstra.
the class FlowServiceImpl method createFlow.
/**
* {@inheritDoc}
*/
@Override
public FlowPayload createFlow(final FlowPayload flow, final String correlationId) {
LOGGER.debug("Create flow: {}={}", CORRELATION_ID, correlationId);
FlowCreateRequest data = new FlowCreateRequest(Converter.buildFlowByFlowPayload(flow));
CommandMessage request = new CommandMessage(data, System.currentTimeMillis(), correlationId, Destination.WFM);
messageConsumer.clear();
messageProducer.send(topic, request);
Message message = (Message) messageConsumer.poll(correlationId);
FlowResponse response = (FlowResponse) validateInfoMessage(request, message, correlationId);
return Converter.buildFlowPayloadByFlow(response.getPayload());
}
use of org.openkilda.messaging.Message in project open-kilda by telstra.
the class FlowServiceImpl method getFlow.
/**
* {@inheritDoc}
*/
@Override
public FlowPayload getFlow(final String id, final String correlationId) {
LOGGER.debug("Get flow: {}={}", CORRELATION_ID, correlationId);
FlowGetRequest data = new FlowGetRequest(new FlowIdStatusPayload(id, null));
CommandMessage request = new CommandMessage(data, System.currentTimeMillis(), correlationId, Destination.WFM);
messageConsumer.clear();
messageProducer.send(topic, request);
Message message = (Message) messageConsumer.poll(correlationId);
FlowResponse response = (FlowResponse) validateInfoMessage(request, message, correlationId);
return Converter.buildFlowPayloadByFlow(response.getPayload());
}
use of org.openkilda.messaging.Message in project open-kilda by telstra.
the class FlowServiceImpl method _deleteFlowRespone.
/**
* Blocking primitive .. waits for the response .. and then converts to FlowPayload.
* @return the deleted flow.
*/
private FlowPayload _deleteFlowRespone(final String correlationId, CommandMessage request) {
Message message = (Message) messageConsumer.poll(correlationId);
FlowResponse response = (FlowResponse) validateInfoMessage(request, message, correlationId);
return Converter.buildFlowPayloadByFlow(response.getPayload());
}
use of org.openkilda.messaging.Message in project open-kilda by telstra.
the class SwitchServiceImpl method syncRules.
@Override
public SyncRulesOutput syncRules(String switchId, String correlationId) {
SyncRulesRequest request = new SyncRulesRequest(switchId);
CommandWithReplyToMessage commandMessage = new CommandWithReplyToMessage(request, System.currentTimeMillis(), correlationId, Destination.TOPOLOGY_ENGINE, northboundTopic);
messageProducer.send(topoEngTopic, commandMessage);
Message message = messageConsumer.poll(correlationId);
SyncRulesResponse response = (SyncRulesResponse) validateInfoMessage(commandMessage, message, correlationId);
return switchMapper.toSuncRulesOutput(response);
}
Aggregations