Ejemplo n.º 1
0
        private ActorRef CreateEndpoint(Address remoteAddress, Address localAddress, AkkaProtocolTransport transport,
                                        RemoteSettings endpointSettings, bool writing, AkkaProtocolHandle handleOption = null, int?refuseUid = null)
        {
            System.Diagnostics.Debug.Assert(_transportMapping.ContainsKey(localAddress));
            System.Diagnostics.Debug.Assert(writing || refuseUid == null);

            ActorRef endpointActor;

            if (writing)
            {
                endpointActor =
                    Context.ActorOf(
                        ReliableDeliverySupervisor.ReliableDeliverySupervisorProps(handleOption, localAddress,
                                                                                   remoteAddress, refuseUid, transport, endpointSettings, new AkkaPduProtobuffCodec(),
                                                                                   _receiveBuffers).WithDeploy(Deploy.Local),
                        string.Format("reliableEndpointWriter-{0}-{1}", AddressUrlEncoder.Encode(remoteAddress),
                                      endpointId.Next()));
            }
            else
            {
                endpointActor =
                    Context.ActorOf(
                        EndpointWriter.EndpointWriterProps(handleOption, localAddress, remoteAddress, refuseUid,
                                                           transport, endpointSettings, new AkkaPduProtobuffCodec(), _receiveBuffers,
                                                           reliableDeliverySupervisor: null).WithDeploy(Deploy.Local),
                        string.Format("endpointWriter-{0}-{1}", AddressUrlEncoder.Encode(remoteAddress), endpointId.Next()));
            }

            Context.Watch(endpointActor);
            return(endpointActor);
        }
Ejemplo n.º 2
0
        private IActorRef CreateEndpoint(
            Address remoteAddress,
            Address localAddress,
            AkkaProtocolTransport transport,
            RemoteSettings endpointSettings,
            bool writing,
            AkkaProtocolHandle handleOption = null,
            int?refuseUid = null)
        {
            System.Diagnostics.Debug.Assert(_transportMapping.ContainsKey(localAddress));
            // refuseUid is ignored for read-only endpoints since the UID of the remote system is already known and has passed
            // quarantine checks

            IActorRef endpointActor;

            if (writing)
            {
                endpointActor =
                    Context.ActorOf(RARP.For(Context.System)
                                    .ConfigureDispatcher(
                                        ReliableDeliverySupervisor.ReliableDeliverySupervisorProps(handleOption, localAddress,
                                                                                                   remoteAddress, refuseUid, transport, endpointSettings, new AkkaPduProtobuffCodec(),
                                                                                                   _receiveBuffers, endpointSettings.Dispatcher)
                                        .WithDeploy(Deploy.Local)),
                                    string.Format("reliableEndpointWriter-{0}-{1}", AddressUrlEncoder.Encode(remoteAddress),
                                                  _endpointId.Next()));
            }
            else
            {
                endpointActor =
                    Context.ActorOf(RARP.For(Context.System)
                                    .ConfigureDispatcher(
                                        EndpointWriter.EndpointWriterProps(handleOption, localAddress, remoteAddress, refuseUid,
                                                                           transport, endpointSettings, new AkkaPduProtobuffCodec(), _receiveBuffers,
                                                                           reliableDeliverySupervisor: null)
                                        .WithDeploy(Deploy.Local)),
                                    string.Format("endpointWriter-{0}-{1}", AddressUrlEncoder.Encode(remoteAddress), _endpointId.Next()));
            }

            Context.Watch(endpointActor);
            return(endpointActor);
        }