scala - Akka actors not receiving Array[Byte]? -


i trying write actor counts messages receives , prints when hits specific number of messages seen.

i got work when sending messages actor string, when try send , array[bytes], actor doesn't perform it's receive function, doesn't invoke catch else case.

code handling strings works:

class countingactor extends actor {    val log = logging(context.system, this)   val starttime = system.currenttimemillis   var count = 0   val actorname = self.path.name    def count: actor.receive = {     case message: string =>       count += 1       if(count % 50000 == 0 && count != 0){         var elapsed = (system.currenttimemillis - starttime) / 1000.0         var mps = count / elapsed         log.info(s"processed $count messages in $elapsed ($mps msg/s) in $actorname")       }      case _ => log.info("something happened , dont know, wasn't string")   }    def receive = count  } 

the code fails process , array[byte] same specify case array[byte] instead of string.

class countingactor extends actor {    val log = logging(context.system, this)   val starttime = system.currenttimemillis   var count = 0   val actorname = self.path.name    def count: actor.receive = {     case message: array[byte] =>       count += 1       if(count % 50000 == 0 && count != 0){         var elapsed = (system.currenttimemillis - starttime) / 1000.0         var mps = count / elapsed         log.info(s"processed $count messages in $elapsed ($mps msg/s) in $actorname")       }      case _ => log.info("something happened , dont know, wasn't string")   }    def receive = count  } 

i've tried scenario

  val s = actorsystem()   val ca = s.actorof(props[countingactor])   ca ! array[byte](1, 1, 0) 

and works fine. try add additional logging after

case message: array[byte] => 

to see this. code doesn't show visible reaction on message if count less 50000, how know "the actor doesn't perform it's receive function"?


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -