Search in sources :

Example 11 with KafkaHandler

use of org.springframework.kafka.annotation.KafkaHandler in project open-kilda by telstra.

the class KafkaMessageListener method onMessage.

/**
 * Handles all messages from kafka and sends to corresponding component for further processing.
 * <p/>
 * @param message received message.
 */
@KafkaHandler
public void onMessage(Message message) {
    try (MDCCloseable closable = MDC.putCloseable(CORRELATION_ID, message.getCorrelationId())) {
        logger.debug("Message received: {} - {}", Thread.currentThread().getId(), message);
        messagingChannel.onResponse(message);
    }
}
Also used : MDCCloseable(org.slf4j.MDC.MDCCloseable) KafkaHandler(org.springframework.kafka.annotation.KafkaHandler)

Aggregations

KafkaHandler (org.springframework.kafka.annotation.KafkaHandler)11 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)9 Builder (org.openkilda.server42.control.messaging.Control.CommandPacket.Builder)7 IslRttControl (org.openkilda.server42.control.messaging.islrtt.IslRttControl)5 Any (com.google.protobuf.Any)4 CommandPacket (org.openkilda.server42.control.messaging.Control.CommandPacket)4 CommandPacketResponse (org.openkilda.server42.control.messaging.Control.CommandPacketResponse)4 SwitchId (org.openkilda.model.SwitchId)3 FlowRttControl (org.openkilda.server42.control.messaging.flowrtt.FlowRttControl)3 HashSet (java.util.HashSet)2 AddFlow (org.openkilda.server42.control.messaging.flowrtt.AddFlow)2 Flow (org.openkilda.server42.control.messaging.flowrtt.FlowRttControl.Flow)2 RemoveFlow (org.openkilda.server42.control.messaging.flowrtt.RemoveFlow)2 IslEndpoint (org.openkilda.server42.control.messaging.islrtt.IslRttControl.IslEndpoint)2 MDCCloseable (org.slf4j.MDC.MDCCloseable)2 Control (org.openkilda.server42.control.messaging.Control)1 ListFlowsResponse (org.openkilda.server42.control.messaging.flowrtt.ListFlowsResponse)1 ListIslsResponse (org.openkilda.server42.control.messaging.islrtt.ListIslsResponse)1