1 /*
2  * Copyright (c) 2013-2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  *
8  */
9 
10 #ifndef OPENBMP_KAFKAEVENTCALLBACK_H
11 #define OPENBMP_KAFKAEVENTCALLBACK_H
12 
13 #include <librdkafka/rdkafkacpp.h>
14 #include "Logger.h"
15 
16 class KafkaEventCallback : public RdKafka::EventCb {
17 
18 public:
19     /**
20      * Constructor for callback
21      *
22      * \param isConnected[in,out]   Pointer to isConnected bool to indicate if connected or not
23      * \param logPtr[in]            Pointer to the Logger class to use for logging
24      */
25     KafkaEventCallback(bool *isConnectedRef, Logger *logPtr);
26 
27     void event_cb (RdKafka::Event &event);
28 
29     void setLogger(Logger *logPtr);
30 
31 private:
32     Logger *logger;
33     bool   *isConnected;           // Indicates if connected to the broker or not.
34 };
35 
36 
37 #endif //OPENBMP_KAFKAEVENTCALLBACK_H
38