[VOL-1862] rwCore waits for Kafka and KV Store
This commit consists of the following:
1) Make the rw_core wait for kafka and KV Store to be up before
proceeding with its processing. Previously, rw_core would have
bailed out if kafka/KV was not available. The number of retries
(default=-1, i.e retry forever) and retry interval are both
configurable.
2) Remove a non-json printable variable from the debug log in the
model.
Change-Id: I8d1ef90bf5d202a6f8ae59610aa780292b2844ce
diff --git a/kafka/sarama_client.go b/kafka/sarama_client.go
index 0576da9..8037002 100755
--- a/kafka/sarama_client.go
+++ b/kafka/sarama_client.go
@@ -228,6 +228,13 @@
var err error
+ // Add a cleanup in case of failure to startup
+ defer func() {
+ if err != nil {
+ sc.Stop()
+ }
+ }()
+
// Create the Cluster Admin
if err = sc.createClusterAdmin(); err != nil {
log.Errorw("Cannot-create-cluster-admin", log.Fields{"error": err})