use of org.openkilda.messaging.command.CommandMessage 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.command.CommandMessage 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.command.CommandMessage in project open-kilda by telstra.
the class FlowServiceImpl method deleteFlow.
/**
* {@inheritDoc}
*/
@Override
public FlowPayload deleteFlow(final String id, final String correlationId) {
LOGGER.debug("Delete flow: {}={}", CORRELATION_ID, correlationId);
messageConsumer.clear();
CommandMessage request = _sendDeleteFlow(id, correlationId);
return _deleteFlowRespone(correlationId, request);
}
use of org.openkilda.messaging.command.CommandMessage 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.command.CommandMessage in project open-kilda by telstra.
the class FlowServiceImpl method _sendDeleteFlow.
/**
* Non-blocking primitive .. just create and send delete request
* @return the request
*/
private CommandMessage _sendDeleteFlow(final String id, final String correlationId) {
Flow flow = new Flow();
flow.setFlowId(id);
FlowDeleteRequest data = new FlowDeleteRequest(flow);
CommandMessage request = new CommandMessage(data, System.currentTimeMillis(), correlationId, Destination.WFM);
messageProducer.send(topic, request);
return request;
}
Aggregations