Skip to content

spawne with actorbuilder would cause AmbiguousMatchException #198

Open
@ingted

Description

@ingted

Hi,

let deployRemotely address = Akka.Actor.Deploy(Akka.Actor.RemoteScope (Akka.Actor.Address.Parse address)) 
let spawnRemote systemOrContext remoteSystemAddress actorName expr otherOptionList =  
    Akka.FSharp.Spawn.spawne systemOrContext actorName expr ([Akka.FSharp.Spawn.SpawnOption.Deploy (deployRemotely remoteSystemAddress)] |> List.append otherOptionList)
let raddr = sprintf "akka.tcp://[email protected]:9000"
let actor9000 =
    spawnRemote system raddr ("remoteTest" + System.Guid.NewGuid().ToString())
        <@    
            fun (mailbox: Akka.FSharp.Actors.Actor<string>) ->
                let rec a () = Akka.FSharp.Actors.actor {
                    let! _msg = mailbox.Receive()
                    printfn "%s..." _msg
                    if false then
                        return ""
                    else
                        return! a()
                    
                }
                a()
        @> [Akka.FSharp.Spawn.SpawnOption.SupervisorStrategy(Akka.FSharp.Strategy.OneForOne(fun error ->
            match error with
            | _ -> Akka.Actor.Directive.Resume
            ))]

spawne with a remote deployment would cause AmbiguousMatchException:

System.Reflection.AmbiguousMatchException: More than one matching method found!
   at Hyperion.Extensions.TypeEx.GetMethodExt(MethodInfo& matchingMethod, Type type, String name, BindingFlags bindingFlags, Type[] parameterTypes)
   at Hyperion.Extensions.TypeEx.GetMethodExt(Type thisType, String name, BindingFlags bindingFlags, Type[] parameterTypes)

image

(Because Cont<> has two union cases)

Could anyone provide a hint about how to get a workaround?
Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions