val evntRunner1 = new Runnable { override def run(): Unit = { if (Event1Publisher.get()) { val instant = Instant.now() val timeStamp = Timestamp.newBuilder.setSeconds(instant.getEpochSecond).setNanos(instant.getNano).build() val Event1 : Event1 = XXDSEventsProtos.Event1.newBuilder() .setAzPos(azC) .setElPos(elC) .setAzPosError(azC) .setElPosError(elC) .setAzInPosition(true) .setElInPosition(true) .setTime(timeStamp) //All dummy paramters below .setMcsInPosition(true) .setAzPosDemand(azC) .setElPosDemand(elC) .setEncodeLatchingTime(timeStamp) .setAzPosDmdErrCount(1) .setElPosDmdErrCount(1) .setAzWrapPos(azC) .setAzWrapPosDemand(azC) .setAzWrapPosError(azC) .build() try{ if(pubSocket.sendMore("Event1")){ val currPos : Array[Byte] = DSEvent1.toByteArray if(pubSocket.send(currPos,ZMQ.NOBLOCK)){ println(s"Successfully published Event1 event data ${DSEvent1.getA1},${DSEvent1.getE1},${DSEvent1.getTime} and byteArray: $currPos") }else{ println(s"!!!!!!!! Error occured while publishing current position : $DSEvent1") } }else{ println(s"!!!!!!!! Error occured while publishing current position: $DSEvent1") } }catch{ case e : Exception => e.printStackTrace() println("------------------- Exception occured while publishing current position event.---------------------------") } } } } val eventRunner2 : Runnable = new Runnable { override def run(): Unit = { if (Event2Publisher.get()) { val instant = Instant.now() val timeStamp = Timestamp.newBuilder.setSeconds(instant.getEpochSecond).setNanos(instant.getNano).build() val event2 = XXDSEventsProtos.Event2.newBuilder() .setHealthMCS(XXDSEventsProtos.Event2.Health.Good) .setReason("All is well") .setTime(timeStamp) .build() if(pubSocket.sendMore("Health")){ val healthBytes = mcsHealth.toByteArray if(pubSocket.send(healthBytes,ZMQ.NOBLOCK)){ println(s"Sent health event: $event2 with bytes : $healthBytes") }else{ println(s"!!!!!!!! Error occured while publishing health information : $mcsHealth") } } } } }