GithubHelp home page GithubHelp logo

typesafehub / activator-akka-java-spring Goto Github PK

View Code? Open in Web Editor NEW
115.0 115.0 57.0 254 KB

Activator tutorial for Akka showing Java & Spring integration

License: Other

Java 40.96% Scala 2.81% HTML 56.22%

activator-akka-java-spring's People

Contributors

2m avatar bantonsson avatar danielnixon avatar jamesward avatar jsuereth avatar maddingo avatar patriknw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

activator-akka-java-spring's Issues

Unable to start actor in init method

I am observing a problem that when I try to create an actor and send a message to it using Spring's @PostConstruct I get a NPE exception. If I create an actor from a method call and send a message to an actor then it works. Is this a known limitation?

Trying to use similar method, failing?

I am trying to use this method of a Spring "extension". In my Spring java config class I have a bean defined like

... public class TestActor extends UntypedActor {...

@Bean
public TestActor testActor() {
    return new TestActor();
}

Then I have a spring unit-test that loads off this Java config and does...

ActorRef testActor = myAkkaSystemBean.actorOf(SpringExtProvider.get(system).props("TestActor"),"TestActor");

Then I get this exception:

Caused by: akka.actor.ActorInitializationException: You cannot create an instance of [org.bitsofinfo.coredata.experimental.akka.TestActor] explicitly using the constructor (new). You have to use one of the 'actorOf' factory methods to create a new actor. See the documentation.
    at akka.actor.ActorInitializationException$.apply(Actor.scala:173)
    at akka.actor.Actor$class.$init$(Actor.scala:436)
    at akka.actor.UntypedActor.<init>(UntypedActor.scala:97)
    at org.bitsofinfo.coredata.experimental.akka.TestActor.<init>(TestActor.java:11)
    at org.bitsofinfo.coredata.experimental.akka.AkkaConfig.testActor(AkkaConfig.java:33)
    at org.bitsofinfo.coredata.experimental.akka.AkkaConfig$$EnhancerBySpringCGLIB$$204aa21.CGLIB$testActor$0(<generated>)
    at org.bitsofinfo.coredata.experimental.akka.AkkaConfig$$EnhancerBySpringCGLIB$$204aa21$$FastClassBySpringCGLIB$$f4f62948.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
    at org.bitsofinfo.coredata.experimental.akka.AkkaConfig$$EnhancerBySpringCGLIB$$204aa21.testActor(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
    ... 44 common frames omitted

So my question is, how can I define all my actors in spring XML or java config, then just load them by name if constructing them, blows up like this?

Testing akka-java-spring integration

Well,
this code definitely works but this technique proposed here seems hard to test.

The idea of DI when it comes to testing is to be able to mock some these dependencies to test certain behaviors. It does not seem trivial to combine the technique of the SpringActorProducer with Akka's Testkit and say Mockito for testing.

Does someone have any code to promote this nice PoC from it works to works and tested?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.