Akka 如何在java中获取已创建的TypedActor实例

Akka 如何在java中获取已创建的TypedActor实例,akka,typedactor,Akka,Typedactor,我使用的代码如下: TypedActor.get(actorSystem).typedActorOf(new TypedProps<UserActor>(IUserActor.class, new Creator<UserActor>() { @Override public UserActor create() throws Exception { return new UserActor(userId);

我使用的代码如下:

TypedActor.get(actorSystem).typedActorOf(new TypedProps<UserActor>(IUserActor.class, new Creator<UserActor>() {
        @Override
        public UserActor create() throws Exception {
            return new UserActor(userId);
        }
    }), userId);
用户参与者首先在代码中的某个位置创建,如下所示:

TypedActor.get(actorSystem).typedActorOf(new TypedProps<UserActor>(IUserActor.class, new Creator<UserActor>() {
        @Override
        public UserActor create() throws Exception {
            return new UserActor(userId);
        }
    }), userId);

我做错了什么?谢谢

Akka返回接口的代理,而不是实现,您应该执行以下操作:

 IUserActor userActor = TypedActor.get(actorSystem).typedActorOf(new TypedProps<IUserActor>(UserActor.class), userActorRef);
IUserActor-userActor=TypedActor.get(actorSystem.typedActorOf(新的TypedProps(userActor.class),userActorRef);

Akka返回接口的代理,而不是实现,您应该执行以下操作:

 IUserActor userActor = TypedActor.get(actorSystem).typedActorOf(new TypedProps<IUserActor>(UserActor.class), userActorRef);
IUserActor-userActor=TypedActor.get(actorSystem.typedActorOf(新的TypedProps(userActor.class),userActorRef);

为什么示例中省略了UserActor的定义?UserActor只是实现了一些接口IUserActor:公共类UserActor实现了IUserActor。我还在问题中添加了actor创建代码。我要问的是actor对于非类型转换器的模拟,或者上面的代码中可能有一些错误…你能添加堆栈跟踪吗?添加,但是没有什么特别的…为什么示例中省略了UserActor的定义?UserActor只是实现了一些接口IUserActor:公共类UserActor实现了IUserActor。我还在问题中添加了actor创建代码。我要问的是actor对于非类型转换器的模拟,或者上面的代码中可能有一些错误…你能添加堆栈跟踪吗?添加了,但没有什么特别的。。。