Search in sources :

Example 1 with Destination

use of org.openkilda.messaging.Destination in project open-kilda by telstra.

the class RecordHandler method doControllerMsg.

protected void doControllerMsg(CommandMessage message) {
    // Define the destination topic where the reply will be sent to.
    final String replyToTopic;
    if (message instanceof CommandWithReplyToMessage) {
        replyToTopic = ((CommandWithReplyToMessage) message).getReplyTo();
    } else {
        replyToTopic = OUTPUT_FLOW_TOPIC;
    }
    final Destination replyDestination = getDestinationForTopic(replyToTopic);
    try {
        CommandData data = message.getData();
        handleCommand(message, data, replyToTopic, replyDestination);
    } catch (FlowCommandException e) {
        ErrorMessage error = new ErrorMessage(e.makeErrorResponse(), System.currentTimeMillis(), message.getCorrelationId(), replyDestination);
        context.getKafkaProducer().postMessage(replyToTopic, error);
    } catch (Exception e) {
        logger.error("Unhandled exception: {}", e);
    }
}
Also used : Destination(org.openkilda.messaging.Destination) CommandWithReplyToMessage(org.openkilda.messaging.command.CommandWithReplyToMessage) DiscoverIslCommandData(org.openkilda.messaging.command.discovery.DiscoverIslCommandData) CommandData(org.openkilda.messaging.command.CommandData) DiscoverPathCommandData(org.openkilda.messaging.command.discovery.DiscoverPathCommandData) NetworkCommandData(org.openkilda.messaging.command.discovery.NetworkCommandData) ErrorMessage(org.openkilda.messaging.error.ErrorMessage) SwitchOperationException(org.openkilda.floodlight.switchmanager.SwitchOperationException)

Aggregations

SwitchOperationException (org.openkilda.floodlight.switchmanager.SwitchOperationException)1 Destination (org.openkilda.messaging.Destination)1 CommandData (org.openkilda.messaging.command.CommandData)1 CommandWithReplyToMessage (org.openkilda.messaging.command.CommandWithReplyToMessage)1 DiscoverIslCommandData (org.openkilda.messaging.command.discovery.DiscoverIslCommandData)1 DiscoverPathCommandData (org.openkilda.messaging.command.discovery.DiscoverPathCommandData)1 NetworkCommandData (org.openkilda.messaging.command.discovery.NetworkCommandData)1 ErrorMessage (org.openkilda.messaging.error.ErrorMessage)1