Hello,

I'm new to AKKA and I really like it! It is a create framework. Acutally I 
have build an example, where I'm using the akka Eventbus. My requirement is 
to say, that I want to have subscribers, that are handled by akka routing 
techniques to simply provide more than one actor, that will do the work 
implemented in the subscriber.

You can find the example here at my github repo.
Here the full source code

Here some snippets:

trait Msg
> case class StrMsg(str: String) extends Msg
> case class IntMsg(int: Int) extends Msg
> ....
>   val strRouter = 
> context.actorOf(Props[RoundRobinEventBusSubscriber[StrSubscriber]])     
>  val intRouter = 
> context.actorOf(Props[RoundRobinEventBusSubscriber[IntSubscriber]]) 
> ...
> for (i <- 1 to 50) context.system.eventStream.publish(StrMsg("STR MSG NO 
> %d" format i))
> ...



The following class should create the router according to given T and 
subscribe to the event-stream. If some Msg's are available, these messages 
have to be banged to the router, that will do the work. This class I want 
to reuse for different concrete subscribers ( see code above )


class RoundRobinEventBusSubscriber[T <: Actor: ClassTag] extends Actor { // 
> <-------------------------------------------
>   
>   private val routees = context.actorOf(RoundRobinPool(5).props(Props[T])) 
> // <-----------------------------------------
>   override def preStart {
>     super.preStart
>     context.system.eventStream.subscribe(context.self, classOf[Msg])
>   }
>   override def postStop {
>     context.system.eventStream.unsubscribe(context.self, classOf[Msg])
>     super.postStop
>   }
>   def receive = { case msg: Msg => routees ! msg }
>   
> } 
> ....
> class StrSubscriber extends Actor {
>   
>   def receive = {
>     case StrMsg(str) => println("StrSubscriber %s receives %s" format 
> (self.path.name, str))
>   }
>   
> }
> ...


Here the error, that I will get:

> [akka-robin-bus-akka.actor.default-dispatcher-3] 
> [akka://akka-robin-bus/user/$a] no matching constructor found on class 
> de.examples.RoundRobinEventBusSubscriber for arguments []
> java.lang.IllegalArgumentException: no matching constructor found on class 
> de.examples.RoundRobinEventBusSubscriber for arguments []
> at akka.util.Reflect$.error$1(Reflect.scala:82)
> at akka.util.Reflect$.findConstructor(Reflect.scala:106)



I have googled for it, but I have not found any solution for it. What I 
have to do, Feel free to use the published sample at my Github ( see link 
at the beginning ) if needed.

Is there maybe another "Akka way" to perform something like this here?


Thanks in advance!

Cheers!

Christian

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: http://akka.io/faq/
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to