[SEBA-265]

Poll for Kafka callback, flush at exit

Change-Id: I56b41f86c3df0463590682f6e6230de880fe6a4f
diff --git a/VERSION b/VERSION
index 49c00f0..ebf14b4 100644
--- a/VERSION
+++ b/VERSION
@@ -1,2 +1 @@
-2.1.7
-
+2.1.8
diff --git a/containers/chameleon/Dockerfile.chameleon b/containers/chameleon/Dockerfile.chameleon
index 09db322..c35782a 100644
--- a/containers/chameleon/Dockerfile.chameleon
+++ b/containers/chameleon/Dockerfile.chameleon
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/chameleon
-FROM xosproject/xos-base:2.1.5
+FROM xosproject/xos-base:2.1.8
 
 # xos-base already has protoc and dependencies installed
 
diff --git a/containers/xos/Dockerfile.client b/containers/xos/Dockerfile.client
index 8cb27ef..6bcb072 100644
--- a/containers/xos/Dockerfile.client
+++ b/containers/xos/Dockerfile.client
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-client
-FROM xosproject/xos-libraries:2.1.6
+FROM xosproject/xos-libraries:2.1.8
 
 # Install XOS client
 COPY xos/xos_client /tmp/xos_client
diff --git a/containers/xos/Dockerfile.libraries b/containers/xos/Dockerfile.libraries
index 0308298..b4af5a4 100644
--- a/containers/xos/Dockerfile.libraries
+++ b/containers/xos/Dockerfile.libraries
@@ -12,7 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-FROM xosproject/xos-base:2.1.6
+FROM xosproject/xos-base:2.1.8
 
 # Add libraries
 COPY lib /opt/xos/lib
diff --git a/containers/xos/Dockerfile.synchronizer-base b/containers/xos/Dockerfile.synchronizer-base
index 7490a10..7594539 100644
--- a/containers/xos/Dockerfile.synchronizer-base
+++ b/containers/xos/Dockerfile.synchronizer-base
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-synchronizer-base
-FROM xosproject/xos-client:2.1.6
+FROM xosproject/xos-client:2.1.8
 
 COPY xos/synchronizers/new_base /opt/xos/synchronizers/new_base
 COPY xos/xos/logger.py /opt/xos/xos/logger.py
diff --git a/containers/xos/Dockerfile.xos-core b/containers/xos/Dockerfile.xos-core
index 621c35d..570fd76 100644
--- a/containers/xos/Dockerfile.xos-core
+++ b/containers/xos/Dockerfile.xos-core
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-core
-FROM xosproject/xos-libraries:2.1.6
+FROM xosproject/xos-libraries:2.1.8
 
 # Install XOS
 ADD xos /opt/xos
diff --git a/lib/xos-kafka/xoskafka/xoskafkaproducer.py b/lib/xos-kafka/xoskafka/xoskafkaproducer.py
index 6781311..b4134d5 100644
--- a/lib/xos-kafka/xoskafka/xoskafkaproducer.py
+++ b/lib/xos-kafka/xoskafka/xoskafkaproducer.py
@@ -64,9 +64,16 @@
                 callback=cls._kafka_delivery_callback
                 )
 
+            # see https://github.com/confluentinc/confluent-kafka-python/issues/16
+            kafka_producer.poll(0)
+
         except confluent_kafka.KafkaError, err:
             log.exception("Kafka Error", err)
 
+    def __del__(self):
+       if kafka_producer is not None:
+            kafka_producer.flush()
+
     @staticmethod
     def _kafka_delivery_callback(err, msg):
         if err: