Search in sources :

Example 1 with KafkaMessage

use of org.openkilda.wfm.protocol.KafkaMessage in project open-kilda by telstra.

the class PopulateIslFilterAction method handle.

@Override
protected void handle() throws MessageFormatException, UnsupportedActionException, JsonProcessingException {
    KafkaMessage input = new KafkaMessage(getTuple());
    Message message = input.getPayload();
    if (message.getDestination() != Destination.WFM_OF_DISCOVERY) {
        return;
    }
    if (!(message instanceof CommandMessage)) {
        return;
    }
    CommandMessage command = (CommandMessage) message;
    if (!(command.getData() instanceof DiscoveryFilterPopulateData)) {
        return;
    }
    DiscoveryFilterPopulateData payload = (DiscoveryFilterPopulateData) command.getData();
    logger.info("Clean ISL filter");
    filter.clear();
    for (DiscoveryFilterEntity entity : payload.getFilter()) {
        logger.info("Add ISL filter record - switcID=\"{}\" portId=\"{}\"", entity.switchId, entity.portId);
        filter.add(entity.switchId, entity.portId);
    }
}
Also used : DiscoveryFilterEntity(org.openkilda.messaging.command.discovery.DiscoveryFilterEntity) Message(org.openkilda.messaging.Message) KafkaMessage(org.openkilda.wfm.protocol.KafkaMessage) CommandMessage(org.openkilda.messaging.command.CommandMessage) KafkaMessage(org.openkilda.wfm.protocol.KafkaMessage) DiscoveryFilterPopulateData(org.openkilda.messaging.command.discovery.DiscoveryFilterPopulateData) CommandMessage(org.openkilda.messaging.command.CommandMessage)

Example 2 with KafkaMessage

use of org.openkilda.wfm.protocol.KafkaMessage in project open-kilda by telstra.

the class CtrlEmbeddedAction method emitResponse.

protected void emitResponse(ResponseData payload) throws JsonProcessingException {
    CtrlResponse response = new CtrlResponse(payload, System.currentTimeMillis(), getMessage().getCorrelationId(), Destination.CTRL_CLIENT);
    KafkaMessage message = new KafkaMessage(response);
    getOutputCollector().emit(getMaster().getStreamId(), getTuple(), message.pack());
}
Also used : KafkaMessage(org.openkilda.wfm.protocol.KafkaMessage) CtrlResponse(org.openkilda.messaging.ctrl.CtrlResponse)

Example 3 with KafkaMessage

use of org.openkilda.wfm.protocol.KafkaMessage in project open-kilda by telstra.

the class RouteAction method handle.

@Override
protected void handle() throws MessageFormatException, JsonProcessingException {
    KafkaMessage input = new KafkaMessage(getTuple());
    Message payload = input.getPayload();
    if (!(payload instanceof CtrlRequest)) {
        getLogger().debug(String.format("Skip foreign message (correlation-id: %s timestamp: %s)", payload.getCorrelationId(), payload.getTimestamp()));
        return;
    }
    handleMessage((CtrlRequest) payload);
}
Also used : Message(org.openkilda.messaging.Message) KafkaMessage(org.openkilda.wfm.protocol.KafkaMessage) CtrlRequest(org.openkilda.messaging.ctrl.CtrlRequest) KafkaMessage(org.openkilda.wfm.protocol.KafkaMessage)

Aggregations

KafkaMessage (org.openkilda.wfm.protocol.KafkaMessage)3 Message (org.openkilda.messaging.Message)2 CommandMessage (org.openkilda.messaging.command.CommandMessage)1 DiscoveryFilterEntity (org.openkilda.messaging.command.discovery.DiscoveryFilterEntity)1 DiscoveryFilterPopulateData (org.openkilda.messaging.command.discovery.DiscoveryFilterPopulateData)1 CtrlRequest (org.openkilda.messaging.ctrl.CtrlRequest)1 CtrlResponse (org.openkilda.messaging.ctrl.CtrlResponse)1