Adding more logging around zmq connection

This commit is contained in:
Chris Stewart 2018-04-27 08:54:42 -05:00
parent 11e365a511
commit d4bef008e5

View File

@ -38,8 +38,9 @@ class ZMQSubscriber(
def start()(implicit ec: ExecutionContext): Future[Unit] = Future {
logger.info("starting zmq")
subscriber.connect(uri)
logger.info("Connection to zmq client successful")
val connected = subscriber.connect(uri)
if (connected) {
logger.info(s"Connection to zmq client successful to $uri")
//subscribe to the appropriate feed
hashTxListener.map { _ =>
subscriber.subscribe(HashTx.topic.getBytes(ZMQ.CHARSET))
@ -72,6 +73,11 @@ class ZMQSubscriber(
logger.error(err.getMessage)
}
}
} else {
logger.info(s"Failed to connect zmq client to $uri")
Future.failed(throw new IllegalArgumentException(s"Failed to connect zmq client to $uri"))
}
}
/**
@ -87,7 +93,8 @@ class ZMQSubscriber(
context.term()
}
/** Processes a message that we received the from the cryptocurrency daemon and then
/**
* Processes a message that we received the from the cryptocurrency daemon and then
* applies the appropriate listener to that message.
*/
private def processMsg(topic: String, body: Seq[Byte])(implicit ec: ExecutionContext): Future[Unit] = {