Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 02:00

    sean-gilliam on sean-gilliam-patch-1

    (compare)

  • 01:58

    sean-gilliam on sean-gilliam-patch-1

    Update akkadotnet-v1.4.md Fix … (compare)

  • Feb 28 21:04

    Aaronontheweb on 1.4.1-rc1

    (compare)

  • Feb 28 21:02
    Aaronontheweb closed #4282
  • Feb 28 20:54
    Aaronontheweb opened #4282
  • Feb 28 20:54

    Aaronontheweb on dev

    added Akka.NET v1.4.1-rc1 relea… (compare)

  • Feb 28 20:54
    Aaronontheweb closed #4281
  • Feb 28 20:50
    Aaronontheweb opened #4281
  • Feb 28 20:21
    Aaronontheweb synchronize #4270
  • Feb 28 20:20

    Aaronontheweb on dev

    v1.4.0 migration guide (#4280) … (compare)

  • Feb 28 20:20
    Aaronontheweb closed #4280
  • Feb 28 20:20
    Aaronontheweb closed #4279
  • Feb 28 20:20
    Aaronontheweb closed #4277
  • Feb 28 20:14
    Aaronontheweb ready_for_review #4280
  • Feb 28 20:14
    Aaronontheweb edited #4280
  • Feb 28 20:14
    Aaronontheweb synchronize #4280
  • Feb 28 20:07
    Aaronontheweb synchronize #4280
  • Feb 28 19:35
    Aaronontheweb synchronize #4280
  • Feb 28 18:28
    Aaronontheweb edited #4280
  • Feb 28 18:27
    Aaronontheweb commented #4280
Kris Schepers
@schepersk
@Horusiath Got things working with the sqlite persistence plugin. There seems to be a problem with the current nuget package for Akka.Cluster.Sharding. Had to take the latest version of de DEV branch, compile it myself and reference that to my project in order to get it to work. It failed on recovering from the journal/snapshot with an ObjectReferenceNullException in PersistentShard.ReceiveRecover for an EntityStarted event.
Bartosz Sypytkowski
@Horusiath
@schepersk have you setup snapshot store the same way as journal? Also are you using Wire as default serializer?
Kris Schepers
@schepersk
Not not using Wire for serializer, default. I've taken the configuration for journal and snapshot from the example you pointed to in de repo.
Bartosz Sypytkowski
@Horusiath
the example uses it by default
Kris Schepers
@schepersk
Wire yes, but I was referring to the persistence configuration
Roy van Kaathoven
@Rovak
is there an akka.net equivelant for passing an actor instance to props, like in scala?
val actorInstance = new MyActor()
val props = Props(actorInstance )
Bartosz Sypytkowski
@Horusiath
@Rovak you can pass expression Props.Create(() => new MyActor())
Roy van Kaathoven
@Rovak
@Horusiath thanks, but i wanna work with existing instances which i need to pass to Props. The following example doesn't seem to work because the expression i pass is different from the one that Props is expecting
var actorInstance = new MyActor(arg1, arg2, arg3)
var props = Props.Create(() => actorInstance);
I know it isn't best practise and even considered bad, but i'm trying to upgrade an existing framework to start using Akka, and right now the instances are being created in different factories
Bartosz Sypytkowski
@Horusiath
AFAIK in akka on the JVM you also cannot construct actors directly - taken from akka source code:
throw ActorInitializationException(
        s"You cannot create an instance of [${getClass.getName}] explicitly using the constructor (new). " +
          "You have to use one of the 'actorOf' factory methods to create a new actor. See the documentation.")
Roy van Kaathoven
@Rovak

In play framework i use the following code snippet to construct child actors in the ActorExample class

class ActorExample @Inject(injector: Injector)  extends Actor (

def buildInstance(action: ActionConfig) = {
    context.actorOf(Props(injector.instanceOfWithParams(action.instance)(action)))
  }

}

injector.instanceOfWithParams uses Guice to create an Actor instance, which i then pass to Props.

actionconfig
trait ActionConfig {
      var id = 0
      var name = ""
      def instance: Class[_]
    }
so it just creates a new instance based on the given Type/Class and then passes the ActionConfig to its constructor

Something similiar doesn't seem to work in Akka.net

    [TestFixture]
    class ServerActorTest
{
        public ServerActor CreateInstance()
        {
            return new ServerActor();
        }

        [Test]
        public async Task TestServer2()
        {
            var system = ActorSystem.Create("MySystem");

            var serverActor = system.ActorOf(Props.Create(() => CreateInstance()));
        }
}

which throws

System.InvalidCastException : Could not convert object of type System.Linq.Expressions.InstanceMethodCallExpressionN to System.Linq.Expressions.NewExpression.
Bartosz Sypytkowski
@Horusiath
Props.Create expects expression to be passed, because what it does underneat is desconstructing it into prime elements (namely actor type and list of arguments passed to it's constructor)
Roy van Kaathoven
@Rovak
yea i understand that, i just wanna know if i'm missing a method which accepts an instance, or i need to create a PR which allows instances to be passed to Props
Bartosz Sypytkowski
@Horusiath
it's not allowed, and probably won't be - props needs to be serializable/deserializable
Roy van Kaathoven
@Rovak
only when transfered over the wire when using Akka.Remote afaik?
Bartosz Sypytkowski
@Horusiath
always when it can be part of the message, introducing it would expose whole new category of runtime errors, without actual reason
btw. what signature does injector.instanceOfWithParams has?
Roy van Kaathoven
@Rovak
 def instanceOfWithParams(clazz: Class[_])(parms: Object*)
Bartosz Sypytkowski
@Horusiath
and returned type?
Roy van Kaathoven
@Rovak
Actor
Alex Achinfiev
@aachinfiev
Hi folks. I have a question about dynamic system creation with different configuration. I need to be able to provide some dynamic configuration and currently we are just spawning multiple systems within the same topshelf startup based on list of roles we want in config file. Can one actor system actually spawn other systems so you could send a message and make this more dynamic? Thanks
ilhadad
@ilhadad
Is it possible to add different actor types to a sharded region?
Bartosz Sypytkowski
@Horusiath
@Rovak maybe I should ask this at the beggining - if you're injecting actors to be created, why don't you use akka dependency injection plugins?
Onam
@OnamChilwan
I am using Akka TestKit but I have an actor which creates a child actor and sends it a message. The trouble is when unit testing I only want to test the parent actor in isolation however when I run the test it also invokes the child actor. Is there a way to prevent this? Seems I can add the child actor as a dependency and I can substitute this with a BlackholeActor from a unit test
Bartosz Sypytkowski
@Horusiath
@ilhadad you can create multiple sharded regions in each actor system, one per type name
@OnamChilwan TestKit is more integration-like test type than unit-tests, usually actors perform some business action in cooperation, so to test it, you need to make sure, that whole topology of actors is working fine
Roy van Kaathoven
@Rovak
@Horusiath the framework uses multiple Ninject containers, and afaik the ActorSystem can only have 1 DI container
Onam
@OnamChilwan
@Horusiath ah right so for unit testing actors simply don't use TestKit?
Stick to basic unit testing and assert agianst behavior as opposed to asserting messages have been published etc as this will be covered from integration tests via Testkit
Bartosz Sypytkowski
@Horusiath
@OnamChilwan I would faster forget about unit testing, than testkit specs ;) This image well describes sense of testing components working together in isolation:
@Rovak don't get me wrong, I really don't want to offend anybody here, but don't all those issues point to some complexity problems on your company app side?
Bartosz Sypytkowski
@Horusiath
@aachinfiev you could have one centralized config provider service (i.e. zookeeper, consul) that you could ask for configuration before starting an actor system
then simply retrieve actual config for current service from it
Roy van Kaathoven
@Rovak
@Horusiath no offence taken, the app is indeed pretty complex, its an enterprise service bus. The app may load multiple projects and these projects should never be allowed to share instances like repositories, database connections, services etc. so each project has their own ninject container. Right now some services which do work in different threads have locks which i want to replace with actors and message passing
there are a LOT of services, and i can't rewrite everything at once. So i want to create a migration path which may not look pretty in the beginning, but i can then slowly refactor everything to akka actors
Zetanova
@Zetanova
@Horusiath I am still at actor pattern, my current problem is that before i had the same state-model-type for the AR-state and for the read-model. Now i am changing that the AR is using his own State-type. The problem is that the Sender of the create-command shouled be informed with the newly created read-model. I have the idea, to pass a non-persitent event to the EventBus so that the ReadModelProjector can tell the Sender of the create command the entity
But it seams wrong
Roy van Kaathoven
@Rovak
I tried a different approach where the factories now build Props instances instead, which seems to work fine.
Bartosz Sypytkowski
@Horusiath
@Rovak this or returning Expr<ActorBase> could work
@Zetanova the view side of persistence plugin is lacking some features. That's why it was obsoleted on the jvm side in favor of persistence queries (which we will probably done too, once streams and persistence query will be ported). Btw. this idea with using third mediator seems neat to overcome current limitations.
Zetanova
@Zetanova
@Horusiath readmodel generation is working good, the batching is easy and working well. The buffer of events will be flushed on MaxEventCount and Timeout in a single actor for each AR-type. The events are then grouped by Id and each group is processed by the normal Read-Modify-Update CRUD pattern.
triggered by a special event, I could send the readed read-model back to a requestor,
The other option would be the normal one that the client is generating the read-model internaly on client-side and sends only the create-command, without getting the model back.
but then there is a lag, where one client-component has the read-model and maybe an other need it to be created on the read-side (some query)
Zetanova
@Zetanova
It happens in the UI, after create of some entity the user is moved to the entity-list that need to be refreshed. Of course the possibilty is to inject the client-side created entity into the list, but the "server"-side sorting and paging will be broken
Chris Martin
@trbngr
hello, strangers!
Onam
@OnamChilwan
@Horusiath is it fair to say then it isn't possible to truly unit test an actor in isolation?