I am currently working on IOT Coap protocol.I accessed server on local host through copper firefox plugin. Then i Added resouce having "GET" functionality in server. After that i made its client as a streaming source. Here is the code of client streaming
class customReceiver(test:String) extends Receiver[String](StorageLevel.MEMORY_AND_DISK_2) with Logging with Serializable {
@volatile private var stopped = false
override def onStart() {
val client = new CoapClient("ip/resource")
var text = client.get().getResponseText();
store(text)
}
override def onStop(): Unit = synchronized {
try
{
stopped = true
}
catch
{
case e: Exception => println("exception caught: " + e);
}
}
}
but i am facing a problem. During streaming it just read a resource once. after that it fetches all empty rdd and completes its batches. Meanwhile if resource changes its value it doesn't read that. are i doing something wrong? or is there exists any other functionality to read whenever resource get changed that i can handle in my Custom receiver.? or any idea about how to GET value continuously during streaming?
Any help is much awaited and appreciated. Thanks