how to specify a config file when creating actor system through spring

427 views
Skip to first unread message

Ming Xu

unread,
Sep 14, 2013, 1:57:53 AM9/14/13
to akka...@googlegroups.com
Hello,

I am using Spring 3.2 and Akka 2.1. I am able to create actor system successfully through Spring. However, I have problems to specify a config file for it. Could anyone help? Thanks very much.

xml file:

<?xml version="1.0" encoding="UTF-8"?>

xsi:schemaLocation="


<context:annotation-config />

<bean id="myActorSystem" class="akka.actor.ActorSystem"

    factory-method="create" destroy-method="shutdown" scope="singleton">

    <constructor-arg value="myActorSystem" />

</bean>

</beans>

application.conf

myActorSystem {

    my-dispatcher {

        mailbox-type = com.test.mailbox.MongoMailboxType

    }

}

Java code to create actor:

@Configuration

public class myActorConfig {

    @Autowired

    ActorSystem myActorSystem; 

    @Bean

    @Scope(value=ConfigurableBeanFactory.SCOPE_PROTOTYPE)

 

    public ActorRef myActor() {

        return importActorSystem.actorOf(Props.create(MyActor.class).withDispatcher("my-dispatcher"));

    }  


Error message:
Dispatcher [my-dispatcher] not configured for path akka://myActorSystem/user/$a 
I always got the error even though I have a configuration for myActorSystem in application.conf. I did many study and test, but could not make it work.

Patrik Nordwall

unread,
Sep 15, 2013, 3:28:21 AM9/15/13
to akka...@googlegroups.com, akka...@googlegroups.com
Hi,

Given the above application.conf the dispatcher should have id: "myActorSystem.my-dispatcher"

/Patrik


    }  


Error message:
Dispatcher [my-dispatcher] not configured for path akka://myActorSystem/user/$a 
I always got the error even though I have a configuration for myActorSystem in application.conf. I did many study and test, but could not make it work.

--
>>>>>>>>>> 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 akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/groups/opt_out.

Ming Xu

unread,
Sep 16, 2013, 7:55:24 PM9/16/13
to akka...@googlegroups.com
It works! I really appreciate your help!

Ming
Reply all
Reply to author
Forward
0 new messages