Beispiel #1
0
        public DataReceiver()
        {
            TimeSpan throttle = TimeSpan.FromMilliseconds(100);

            string RegistryConnectionString = "akka.tcp://DataSourceActorSystem@" + serverURL + ":" + serverPort + "/user/DataSourceActor";

            ColourConsole.WriteLineMagenta("Sending ConnectMessage");
            ConnectMessage requestAccess = Context.ActorSelection(RegistryConnectionString).Ask <ConnectMessage>(new ConnectMessage(Self)).Result;//Changes

            DataSourceActorRef = requestAccess.ActorRef;

            Receive <PrepareUpload>(prepare =>
            {
                ColourConsole.WriteLineMagenta("Sending MeasurementsSinkReady");
                // obtain a sink you want to offer
                var sink = LogsSinksFor(prepare.Id);

                // materialize sink ref (remote is source data for us)
                StreamRefs.SinkRef <string>()
                .Throttle(1, throttle, 1, ThrottleMode.Shaping)
                .To(sink)
                .Run(Context.System.Materializer())
                //I suspect the issue is within the "PipeTo" method, The remote actor never receives the "MeasurementsSinkReady" message
                .PipeTo(DataSourceActorRef, success: sinkRef => new MeasurementsSinkReady(prepare.Id, sinkRef));
            });
        }
        public DataSource()
        {
            TimeSpan throttle = TimeSpan.FromMilliseconds(1);

            Receive <ConnectMessage>(request =>
            {
                ColourConsole.WriteLineMagenta("Received ConnectMessage");
                DataReceiverActorRef = Sender;
                request.ActorRef     = Self;
                Sender.Tell(request);
            });

            Receive <MeasurementsSinkReady>(request =>
            {
                ColourConsole.WriteLineMagenta("Received MeasurementsSinkReady");
                // create a source
                StreamLogs(request.Id)
                //Throttle outbound stream
                .Throttle(1, throttle, 1, ThrottleMode.Shaping)
                // materialize it using stream refs
                .RunWith(request.SinkRef.Sink, Context.System.Materializer());
            });
        }
Beispiel #3
0
        public DataReceiver()
        {
            TimeSpan throttle = TimeSpan.FromMilliseconds(100);

            Receive <ConnectMessage>(request =>
            {
                ColourConsole.WriteLineMagenta("Received ConnectMessage");
                DataSourceActorRef = Sender;
                request.ActorRef   = Self;
                Sender.Tell(request);
            });

            Receive <LogsOffer>(request =>
            {
                ColourConsole.WriteLineMagenta("Received LogsOffer");

                request.SourceRef.Source
                //Throttle outbound stream
                .Throttle(1, throttle, 1, ThrottleMode.Shaping)
                //State what the sink must do
                .RunForeach(Console.WriteLine, Context.System.Materializer()).Wait();
                Sender.Tell(request);
            });
        }
Beispiel #4
0
        public DataSource()
        {
            TimeSpan throttle = TimeSpan.FromMilliseconds(1);

            string RegistryConnectionString = "akka.tcp://ReceiverActorSystem@" + serverURL + ":" + serverPort + "/user/DataReceiverActor";

            ColourConsole.WriteLineMagenta("Sending ConnectMessage");
            ConnectMessage requestAccess = Context.ActorSelection(RegistryConnectionString).Ask <ConnectMessage>(new ConnectMessage(Self)).Result;//Changes

            DataReceiverActorRef = requestAccess.ActorRef;

            Receive <RequestLogs>(request =>
            {
                ColourConsole.WriteLineMagenta("Sending RequestLogs");
                // create a source
                StreamLogs(request.StreamId)
                //Throttle outbound stream
                .Throttle(1, throttle, 1, ThrottleMode.Shaping)
                // materialize it using stream refs
                .RunWith(StreamRefs.SourceRef <string>(), Context.System.Materializer())
                // and send to sink
                .PipeTo(DataReceiverActorRef, success: sourceRef => new LogsOffer(request.StreamId, sourceRef));    //DataReceiverActorRef was Sender
            });
        }