private void Handle(Setup m) { Become(Ready); Stash.UnstashAll(); ConsoleActor = m.ConsoleActor; var source = SourcesHelper.CommittableQueueWithWithBackoff(option => { option.HostAndPorts = m.HostAndPorts; option.QueueName = m.QueueName; option.UserName = m.UserName; option.Password = m.Password; option.VirtualHost = m.VirtualHost; }); var sinkActor = Sink.ActorRef <(object, ICommitable)>(Self, new CopmleteMessage()); var graph = GraphDsl.Create(source, (builder, start) => { var sink = builder.Add(sinkActor); var flow = builder.Add(FlowsHelper.Deserialize()); builder.From(start) .Via(flow) .To(sink); return(ClosedShape.Instance); }); Context.Materializer().Materialize(graph); }
private void Handle(Setup m) { Become(Ready); Stash.UnstashAll(); var source = Source.ActorRef <object>(5000, OverflowStrategy.DropTail); var sinkActor = Sink.ActorRef <(object, ICommitable)>(Self, new CompleteMessage()); var graph = GraphDsl.Create(source, (builder, start) => { var serializeFlow = builder.Add(FlowsHelper.Serialize() .Recover(ex => { Logger.Error(ex, ""); return(Option <ByteString> .None); }) .Select(x => new OutgoingMessage(x, true, true))); var rpcFlow = builder.Add(FlowsHelper.SimpleRpc(option => { option.HostAndPorts = m.HostAndPorts; option.UserName = m.UserName; option.Password = m.Password; option.QueueName = m.QueueName; option.VirtualHost = m.VirtualHost; })); builder.From(start) .Via(serializeFlow) .Via(rpcFlow) .Via(FlowsHelper.Deserialize()) .To(sinkActor); return(ClosedShape.Instance); }); SourceActor = Context.Materializer().Materialize(graph); }