I would guess the init of the leveldb-shared journal is wrong (or missing).
You can see how to do that in this sample:
http://typesafe.com/activator/template/akka-cluster-sharding-scala

/Patrik

fre 12 jun 2015 kl. 15:19 skrev <[email protected]>:

> Hello,
>
> I'm dooing a POC with akka sharding using akka 2.4-M1. But the message
> sended to sharded actor never is received. I cannot understand it. Can
> someone help me please?
>
> This is my main class:
>
> import akka.actor.{ActorSystem, Props}
> import akka.cluster.sharding.{ClusterSharding, ShardRegion}
> import com.typesafe.config.ConfigFactory
> import scala.concurrent.duration._
> /**
>  * Created by matheus on 09/06/15.
>  */
> object ShardMain {
>   def main(args: Array[String]) {
>     startup(Seq("2552", "0", "0"))
>   }
>
>   def startup(ports: Seq[String]) = {
>     ports foreach { port =>
>       val config = ConfigFactory.parseString("akka.remote.netty.tcp.port=" + 
> port).withFallback(ConfigFactory.load())
>
>       val system = ActorSystem.create("application", config)
>
>       val idExtractor: ShardRegion.IdExtractor = {
>         case msg : CalculateDouble => {
>           println("Number " + msg.number)
>           (msg.number.toString, msg)
>         }
>       }
>
>       val shardResolver: ShardRegion.ShardResolver = {
>         case msg : CalculateDouble => {
>           println("ShardResolver")
>           (msg.number % 2).toString
>         }
>       }
>
>       ClusterSharding(system).start(
>         typeName = DoubleActor.shardName,
>         entryProps = Some(Props[DoubleActor]),
>         roleOverride = None,
>         rememberEntries = false,
>         idExtractor = idExtractor,
>         shardResolver = shardResolver
>       )
>       if(port != "2552") {
>         val shardActor = 
> ClusterSharding(system).shardRegion(DoubleActor.shardName)
>         import system.dispatcher
>         system.scheduler.schedule(5 second, 1 second)(shardActor ! 
> CalculateDouble(1))
>
>       }
>     }
>   }
> }
>
>
> This is my sharded actor:
>
> import akka.persistence.PersistentActor
>
> /**
>  * Created by matheus on 09/06/15.
>  */
>
> object DoubleActor {
>   val shardName: String = "DoubleActor"
> }
> class DoubleActor extends PersistentActor{
>   override def receiveRecover = {
>     case x => println("Received " + x.toString)
>   }
>
>   override def receiveCommand = {
>     case x => println("Received " + x.toString)
>   }
>
>   override def persistenceId = self.path.parent.name + "/" + self.path.name
> }
>
>
> This is the message sended to sharded actor:
>
> /**
>  * Created by matheus on 09/06/15.
>  */
> case class CalculateDouble(number: Long)
>
>
> And this is the application.conf
>
> akka{
>   actor.provider = "akka.cluster.ClusterActorRefProvider"
>
>   remote.netty.tcp {
>     hostname = "127.0.0.1"
>     port = 0
>   }
>
>   cluster {
>     seed-nodes = [
>       "akka.tcp://[email protected]:2552"
>     ]
>     auto-down-unreachable-after = 10s
>   }
>
>   persistence {
>     journal {
>       plugin = "akka.persistence.journal.leveldb-shared"
>       leveldb-shared.store.dir = "target/shared"
>     }
>     snapshot-store{
>       plugin = "akka.persistence.snapshot-store.local"
>       local.dir = "target/snapshots"
>     }
>   }
> }
>
>
> Thank you so much
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> 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/d/optout.
>
-- 
/Patrik

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      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/d/optout.

Reply via email to