Akka integration with Spring and OSGI (no configuration settings for akka key)

One Akka actor has been added to my application that works with Spring and OSGI .

I am trying to use the Actor from Spring @Component bean as follows:

 private final ActorSystem system = ActorSystem.create("actor-system"); private ActorRef managerActorRef = system.actorOf(Props.create(ManagerActor.class), "ldapManagerActor"); 

When I run the application, it throws an exception ( No configuration setting found for key 'akka' ):

 Instantiation of bean failed; nested exception is org.springframework. beans.BeanInstantiationException: Could not instantiate bean class [com.myconpany....ByBean]: Constructor threw exception; nested exception is com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'akka' 

I look at this : doc. And it seems that the root of my problem is related to the class loader , which I have to pass to / for akka-system and application.conf file that describes this.

But I could not find suitable stets for this to work.

Can anyone help?


My attempts:

Current this article .

When I put:

 <bean id="actorSystem" class="akka.actor.ActorSystem" factory-method="create" scope="singleton"></bean> 

I have a similar error:

 Could not autowire field: private akka.actor.ActorSystem com.typesafe.config.ConfigException$Missing: No configuration setting fou nd for key 'akka' 
+4
source share
1 answer

If you just want to use Akka actors, you do not need to go through the application.conf settings. You can just use the default value. Make sure you have a configuration library on the way to your class.

You did not specify which version Akka uses, but if you take the latest version of Akka 2.2 RC, you can use IndirectActorProducer to work with spring wiring.

See this article on how to do this; http://blog.nemccarthy.me/?p=272

You should also tell spring to turn off the shutdown on the ActorSystem for a clean shutdown. There is also an updated guide for integrating ActorSystem into spring or a web application here.

+1
source

Source: https://habr.com/ru/post/1482224/


All Articles