Esempio n. 1
0
        public EndpointWriter(
            AkkaProtocolHandle handleOrActive, 
            Address localAddress, 
            Address remoteAddress,
            int? refuseUid, 
            AkkaProtocolTransport transport, 
            RemoteSettings settings,
            AkkaPduCodec codec, 
            ConcurrentDictionary<EndpointManager.Link, EndpointManager.ResendState> receiveBuffers,
            IActorRef reliableDeliverySupervisor = null) :
            base(localAddress, remoteAddress, transport, settings)
        {
            _handleOrActive = handleOrActive;
            _refuseUid = refuseUid;
            _codec = codec;
            _reliableDeliverySupervisor = reliableDeliverySupervisor;
            _system = Context.System;
            _provider = RARP.For(Context.System).Provider;
            _msgDispatcher = new DefaultMessageDispatcher(_system, _provider, _log);
            _receiveBuffers = receiveBuffers;
            Inbound = handleOrActive != null;
            _ackDeadline = NewAckDeadline();
            _handle = handleOrActive;

            if (_handle == null)
            {
                Context.Become(Initializing);
            }
            else
            {
                Context.Become(Writing);
            }
        }
Esempio n. 2
0
 public static Props ReliableDeliverySupervisorProps(
     AkkaProtocolHandle handleOrActive, 
     Address localAddress, 
     Address remoteAddress,
     int? refuseUid, 
     AkkaProtocolTransport transport, 
     RemoteSettings settings, 
     AkkaPduCodec codec, 
     ConcurrentDictionary<EndpointManager.Link, EndpointManager.ResendState> receiveBuffers,
     string dispatcher)
 {
     return
         Props.Create(
             () =>
                 new ReliableDeliverySupervisor(handleOrActive, localAddress, remoteAddress, refuseUid, transport,
                     settings, codec, receiveBuffers))
                     .WithDispatcher(dispatcher);
 }
Esempio n. 3
0
 protected EndpointActor(Address localAddress, Address remoteAddress, AkkaProtocolTransport transport,
     RemoteSettings settings)
 {
     EventPublisher = new EventPublisher(Context.System, _log, Logging.LogLevelFor(settings.RemoteLifecycleEventsLogLevel));
     LocalAddress = localAddress;
     RemoteAddress = remoteAddress;
     Transport = transport;
     Settings = settings;
 }
Esempio n. 4
0
 public static Props ReaderProps(
     Address localAddress, 
     Address remoteAddress, 
     AkkaProtocolTransport transport,
     RemoteSettings settings, 
     AkkaPduCodec codec, 
     IInboundMessageDispatcher dispatcher, 
     bool inbound, 
     int uid,
     ConcurrentDictionary<EndpointManager.Link, EndpointManager.ResendState> receiveBuffers,
     IActorRef reliableDeliverySupervisor = null)
 {
     return
         Props.Create(
             () =>
                 new EndpointReader(localAddress, remoteAddress, transport, settings, codec, dispatcher, inbound,
                     uid, receiveBuffers, reliableDeliverySupervisor))
                     .WithDispatcher(settings.Dispatcher);
 }
Esempio n. 5
0
 public ReliableDeliverySupervisor(
     AkkaProtocolHandle handleOrActive, 
     Address localAddress, 
     Address remoteAddress,
     int? refuseUid, 
     AkkaProtocolTransport transport, 
     RemoteSettings settings, 
     AkkaPduCodec codec, 
     ConcurrentDictionary<EndpointManager.Link, EndpointManager.ResendState> receiveBuffers)
 {
     this.handleOrActive = handleOrActive;
     _localAddress = localAddress;
     _remoteAddress = remoteAddress;
     _refuseUid = refuseUid;
     _transport = transport;
     _settings = settings;
     this.codec = codec;
     _currentHandle = handleOrActive;
     _receiveBuffers = receiveBuffers;
     Reset();
     _writer = CreateWriter();
     Uid = handleOrActive != null ? (int?)handleOrActive.HandshakeInfo.Uid : null;
     UidConfirmed = Uid.HasValue;
 }
Esempio n. 6
0
 public static Props EndpointWriterProps(AkkaProtocolHandle handleOrActive, Address localAddress,
     Address remoteAddress, int? refuseUid, AkkaProtocolTransport transport, RemoteSettings settings,
     AkkaPduCodec codec, ConcurrentDictionary<EndpointManager.Link, EndpointManager.ResendState> receiveBuffers, IActorRef reliableDeliverySupervisor = null)
 {
     return Props.Create(
         () =>
             new EndpointWriter(handleOrActive, localAddress, remoteAddress, refuseUid, transport, settings,
                 codec, receiveBuffers, reliableDeliverySupervisor));
 }
Esempio n. 7
0
 public EndpointReader(
     Address localAddress, 
     Address remoteAddress, 
     AkkaProtocolTransport transport,
     RemoteSettings settings, 
     AkkaPduCodec codec, 
     IInboundMessageDispatcher msgDispatch, 
     bool inbound,
     int uid, 
     ConcurrentDictionary<EndpointManager.Link, EndpointManager.ResendState> receiveBuffers,
     IActorRef reliableDeliverySupervisor = null) :
     base(localAddress, remoteAddress, transport, settings)
 {
     _receiveBuffers = receiveBuffers;
     _msgDispatch = msgDispatch;
     Inbound = inbound;
     _uid = uid;
     _reliableDeliverySupervisor = reliableDeliverySupervisor;
     _codec = codec;
     _provider = RARP.For(Context.System).Provider;
 }
Esempio n. 8
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));
            System.Diagnostics.Debug.Assert(writing || refuseUid == null);

            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;
        }
Esempio n. 9
0
 public ProtocolTransportAddressPair(AkkaProtocolTransport protocolTransport, Address address)
 {
     ProtocolTransport = protocolTransport;
     Address           = address;
 }
Esempio n. 10
0
 public ReliableDeliverySupervisor(
     AkkaProtocolHandle handleOrActive,
     Address localAddress,
     Address remoteAddress,
     int? refuseUid,
     AkkaProtocolTransport transport,
     RemoteSettings settings,
     AkkaPduCodec codec,
     ConcurrentDictionary<EndpointManager.Link, EndpointManager.ResendState> receiveBuffers)
 {
     _localAddress = localAddress;
     _remoteAddress = remoteAddress;
     _refuseUid = refuseUid;
     _transport = transport;
     _settings = settings;
     _codec = codec;
     _currentHandle = handleOrActive;
     _receiveBuffers = receiveBuffers;
     Reset(); // needs to be called at startup
     _writer = CreateWriter(); // need to create writer at startup
     Uid = handleOrActive != null ? (int?)handleOrActive.HandshakeInfo.Uid : null;
     UidConfirmed = Uid.HasValue;
     Receiving();
     _autoResendTimer = Context.System.Scheduler.ScheduleTellRepeatedlyCancelable(_settings.SysResendTimeout, _settings.SysResendTimeout, Self, new AttemptSysMsgRedelivery(),
             Self);
 }
Esempio n. 11
0
 public ProtocolTransportAddressPair(AkkaProtocolTransport protocolTransport, Address address)
 {
     ProtocolTransport = protocolTransport;
     Address = address;
 }
Esempio n. 12
0
 private InternalActorRef CreateEndpoint(Address recipientAddress, AkkaProtocolTransport transport,
     Address localAddressToUse, long? refuseUid)
 {
     string escapedAddress = Uri.EscapeDataString(recipientAddress.ToString());
     string name = string.Format("endpointWriter-{0}-{1}", escapedAddress, endpointId++);
     InternalActorRef actor =
         Context.ActorOf(
             Props.Create(
                 () => new EndpointActor(localAddressToUse, recipientAddress, transport.Transport, settings)),
             name);
     return actor;
 }