Aaronontheweb on 1.4.16
Aaronontheweb on master
Added v1.4.16 placeholder for n… typo (#4734) Allow different versions of MS … and 2 more (compare)
Aaronontheweb on 1.4.16
Aaronontheweb on dev
Added v1.4.16 release notes (#4… (compare)
Aaronontheweb on 1.4.16
Added v1.4.16 release notes ##… (compare)
dependabot-preview[bot] on nuget
Bump System.Configuration.Confi… (compare)
dependabot-preview[bot] on nuget
Bump NUnit from 3.7.1 to 3.13.0… (compare)
Hi, I'm trying to create a child actor in F# (not using F# api but classes) and I have the following exception:
[ERROR][15/04/2017 09:07:26][Thread 0003][akka://MovieStreamingActorSystem/user/Playback/UserCoordinator/User42] Error while creating actor instance of type Actors+UserActor with 1 args: (System.Int32[])
Cause: [akka://MovieStreamingActorSystem/user/Playback/UserCoordinator/User42#197236877]: Akka.Actor.ActorInitializationException: Exception during creation ---> System.TypeLoadException: Error while creating actor instance of type Actors+UserActor with 1 args: (System.Int32[]) ---> System.MissingMethodException: Constructor on type 'Actors+UserActor' not found.
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at Akka.Actor.Props.ActivatorProducer.Produce()
at Akka.Actor.Props.NewActor()
--- End of inner exception stack trace ---
at Akka.Actor.Props.NewActor()
at Akka.Actor.ActorCell.CreateNewActorInstance()
at Akka.Actor.ActorCell.<>c__DisplayClass115_0.<NewActor>b__0()
at Akka.Actor.ActorCell.UseThreadContext(Action action)
at Akka.Actor.ActorCell.NewActor()
at Akka.Actor.ActorCell.Create(Exception failure)
--- End of inner exception stack trace ---
at Akka.Actor.ActorCell.Create(Exception failure)
at Akka.Actor.ActorCell.SysMsgInvokeAll(EarliestFirstSystemMessageList messages, Int32 currentState)
Although my class is as follows:
type UserActor(userId : int) as this =
inherit ReceiveActor()
let userId = userId
And I try to create it like that:
let newChildActorRef = UserCoordinatorActor.Context.ActorOf(Props.Create(typeof<UserActor>, [|userId|]), "User" + userId.ToString())
Any hints?
Regarding DI (autofac) integration. The docs say: The basic functionality is provided by a DependencyResolver class, that can create Props using the DI container. with example ending with this IDependencyResolver resolver = new XyzDependencyResolver(someContainer, system);
then there's When creating actorRefs straight off your ActorSystem instance, you can use the DI() Extension..
I don't understand that - in the example the resolver isn't used anywhere. And where does the system.DI() method know which DI container to use?
let playback =
spawn system "Playback"
<| fun parentMailbox ->
let child =
spawn parentMailbox "child"
<| fun childMailbox ->
childMailbox.Defer (fun () -> printfn "Child stopping")
printfn "Child started"
let rec childLoop() = actor {
let! msg = childMailbox.Receive()
return! childLoop()
}
childLoop()
cprintfn ConsoleColor.Gray "Creating parent actor..."
// define parent behavior
let rec loop() = actor {
let! msg = parentMailbox.Receive()
child.Forward(msg) // forward all messages through
return! loop ()
}
loop ()