public void ProcSystemActorRestartedByException(Exception e, ActorRef act) { this.ex = e; this.Act = act; mname = "ProcSystemActorRestartedByException"; setted = true; }
public SubscriptionRouterService(IServiceBus bus, SubscriptionRepository repository, string network) { _peerUri = bus.ControlBus.Endpoint.Address.Uri; _repository = repository; _network = network; _peerId = NewId.NextGuid(); _observers = new List<SubscriptionObserver>(); _listeners = new List<BusSubscriptionEventListener>(); _unregister = () => true; _peerUri = bus.ControlBus.Endpoint.Address.Uri; var connector = new BusSubscriptionConnector(bus); _peerCache = ActorFactory.Create<PeerCache>(x => { x.ConstructedBy((fiber, scheduler, inbox) => new PeerCache(connector, _peerId, _peerUri, repository)); x.UseSharedScheduler(); x.HandleOnPoolFiber(); }) .GetActor(); // at this point, existing subscriptions need to be loaded... _repository.Load(this); }
public SubscriptionRouterService(IServiceBus bus, string network) { _peerUri = bus.ControlBus.Endpoint.Address.Uri; _network = network; _peerId = CombGuid.Generate(); _observers = new List<SubscriptionObserver>(); _listeners = new List<BusSubscriptionEventListener>(); _unregister = () => true; _peerUri = bus.ControlBus.Endpoint.Address.Uri; var connector = new BusSubscriptionConnector(bus); _peerCache = ActorFactory.Create<PeerCache>(x => { x.ConstructedBy((fiber, scheduler, inbox) => new PeerCache(fiber, scheduler, connector, _peerId, _peerUri)); x.UseSharedScheduler(); x.HandleOnPoolFiber(); }) .GetActor(); }
public void ProcPostStopException(Exception e, ActorRef act) { this.ex = e; this.Act = act; mname = "ProcPostStopException"; setted = true; }
public void Show(ActorRef actor) { var inbox = actor as ActorInbox; if (inbox == null) return; Trace.WriteLine(new StringRoutingEngineVisitor(inbox.Engine).ToString()); }
void Ilogger.ProcPostStopException(Exception e, ActorRef act) { string s = ""; s += "Exception in PostStop procedure\n"; s += String.Format("In: {0}\n", act.FullName); s += String.Format("Exception: {0}\n", e); Printf(s); }
void Ilogger.ProcSystemActorRestartedByException(Exception e, ActorRef act) { string s = ""; s += "System actor has been restarted by exception\n"; s += String.Format("Actor: {0}\n", act.FullName); s += String.Format("Exception: {0}\n", e); Printf(s); }
void Ilogger.ProcUserActorStoppedByException(Exception e, ActorRef act) { string s = ""; s += "User actor has been stopped by exception\n"; s += String.Format("Actor: {0}\n", act.FullName); s += String.Format("Exception: {0}\n", e); Printf(s); }
public override Task OnActivate() { hub = HubGateway.GetLocalHub(); Timers.Register("flush", flushPeriod, flushPeriod, Flush); return base.OnActivate(); }
void AssertReminderScheduled(ActorRef api) { var scheduled = Reminder(api.Path.Id); IsTrue(()=> scheduled.Id == api.Path.Id); IsTrue(()=> scheduled.Due == TimeSpan.Zero); IsTrue(()=> scheduled.Period == schedule[api]); }
public void ProcNotHandledMsg(ActorRef Sender, object[] args, Type ReturnType, ActorRef act) { this.Sender = Sender; this.args = args; this.ReturnType = ReturnType; this.Act = act; mname = "ProcNotHandledMsg"; setted = true; }
public ActorCore() { RootActor = CreateActorEx(new ActorInstanceGenerator(typeof(Actors.RootActor)), null, ""); //UserActor_ = CreateActor(new ActorInstanceGenerator(typeof(Actors.UserActor)), RootActor, "user"); //var SystemActor = CreateActor(new ActorInstanceGenerator(typeof(Actors.SystemActor)), RootActor, "system"); //LogActor = CreateActor(new ActorInstanceGenerator(typeof(Log.LogActor)), RootActor, "log"); UserActor_ = FindActorByPath("\\user"); LogActor = FindActorByPath("\\system\\log"); }
static async Task Print(ActorRef item) { var details = await item.Ask(new GetInventoryItemDetails()); Console.WriteLine("{0}: {1} {2}", details.Name, details.Total, details.Active ? "" : "(deactivated)"); }
public void ProcMsgInStoppedActor(ActorRef Sender, object[] args, Type ReturnType, ActorRef act) { this.Sender = Sender; this.args = args; this.ReturnType = ReturnType; this.Act = act; mname = "ProcMsgInStoppedActor"; setted = true; }
public Message(Guid id, ActorRef sender, ActorRef receiver, string contract, MessageType type, Type responseType, object[] args) { Id = id; Sender = sender; Type = type; Contract = contract; Response = responseType; Args = args; }
public override ChildrenContainer Remove(ActorRef child) { var set = _toDie.Remove(child); if (set.IsEmpty) { if (_reason is SuspendReason.Termination) return TerminatedChildrenContainer.Instance; return NormalChildrenContainer.Create(InternalChildren.Remove(child.Path.Name)); } return new TerminatingChildrenContainer(InternalChildren.Remove(child.Path.Name), set, _reason); }
public void Equatable_by_path() { var path = ActorPath.From("T", "42"); var ref1 = new ActorRef(path); var ref2 = new ActorRef(path); Assert.True(ref1 == ref2); Assert.True(ref1.Equals(ref2)); }
public void Run(int nodeCount, int roundCount) { _complete = new Future<bool>(); _first = _ringNodeFactory.GetActor(); _first.Request(new Init { NodeCount = nodeCount - 1, RoundCount = roundCount, }, _first); _complete.WaitUntilCompleted(300.Seconds()); }
public void ProcMsgInStoppedActor(string name,Message msg, ActorRef act) { if (msg is AskMessage) { var t = (AskMessage)msg; logger.ProcMsgInStoppedActor(t.Sender, t.args, t.ReturnType, act); return; } if (msg is TellMessage) { var t = (TellMessage)msg; logger.ProcMsgInStoppedActor(t.Sender, t.args, null, act); } }
void Ilogger.ProcNotHandledMsg(ActorRef Sender, object[] args, Type ReturnType, ActorRef act) { string s = ""; s += "Message has no handler in actor \n"; s += String.Format("From: {0}\n", Sender.FullName); s += String.Format("To: {0}\n", act.FullName); s += String.Format("Return type: {0}\n", ReturnType != null ? ReturnType.ToString() : "null"); for (int i = 0; i < args.Length; i++) { s += String.Format("Argument {0} : Type = {1}, Value = {2}\n", i, args[i].GetType(), args[i]); } Printf(s); }
public void ProcNotHandledMsg(string name, Message msg, ActorRef act) { //LogActor.Tell("ProcNotHandledMsg", msg, act); if (msg is AskMessage) { var t = (AskMessage)msg; logger.ProcNotHandledMsg(t.Sender, t.args, t.ReturnType, act); return; } if (msg is TellMessage) { var t = (TellMessage)msg; logger.ProcNotHandledMsg(t.Sender, t.args, null, act); } }
public bool TryGetByRef(ActorRef actor, out ChildRestartStats childRestartStats) { ChildStats stats; if (InternalChildren.TryGet(actor.Path.Name, out stats)) { //Since the actor exists, ChildRestartStats is the only valid ChildStats. var crStats = stats as ChildRestartStats; if (crStats != null && actor.Equals(crStats.Child)) { childRestartStats = crStats; return true; } } childRestartStats = null; return false; }
public void When_two_actors_are_linked() { _a = AnonymousActor.New(inbox => { inbox.Receive<Die>(x => { inbox.Exit(); }); }); _b = AnonymousActor.New(inbox => { _a.Link(inbox); inbox.Receive<Die>(x => { }); }); }
public void An_exit_is_sent_to_an_actor_that_intercepts_exit() { _intercepted = new Future<Exit>(); _receivedA = new Future<A>(); _actor = AnonymousActor.New(inbox => { inbox.Receive<Request<Exit>>(request => { _intercepted.Complete(request.Body); request.Respond(request.Body); }); inbox.Receive<A>(message => { _receivedA.Complete(message); }); }); }
public abstract ChildrenContainer ShallDie(ActorRef actor);
void IActor.Init(IActorSystem system, ActorRef actorRef) { MySystem = system; ActorRef = actorRef; OnInitialise(); }
public StartTail(string filePath, ActorRef reporterActor) { FilePath = filePath; ReporterActor = reporterActor; }
protected Terminated expectTerminated(ActorRef @ref, TimeSpan timeout) { return(ExpectTerminated(@ref, timeout)); }
/// <summary> /// Publishes the specified event. /// </summary> /// <param name="event">The event.</param> /// <param name="subscriber">The subscriber.</param> protected override void Publish(object @event, ActorRef subscriber) { subscriber.Tell(@event); }
public override ChildrenContainer ShallDie(ActorRef actor) { return(new TerminatingChildrenContainer(InternalChildren, _toDie.Add(actor), _reason)); }
public bool IsReadOnly(ActorRef endpoint) { return(readonlyToAddress.ContainsKey(endpoint)); }
public bool IsWritable(ActorRef endpoint) { return(writableToAddress.ContainsKey(endpoint)); }
public PerformanceCounterCoordinatorActor(ActorRef chartingActor) : this(chartingActor, new Dictionary <CounterType, ActorRef>()) { }
/// <summary> /// Have the <see cref="TestActor"/> stop watching an actor. /// </summary> /// <param name="actorToUnwatch">The actor to unwatch.</param> /// <returns>The actor to unwatch, i.e. the parameter <paramref name="actorToUnwatch"/></returns> public ActorRef Unwatch(ActorRef actorToUnwatch) { _testActor.Tell(new TestActor.Unwatch(actorToUnwatch)); return(actorToUnwatch); }
/// <summary> /// Have the <see cref="TestActor"/> watch an actor and receive /// <see cref="Terminated"/> messages when the actor terminates. /// </summary> /// <param name="actorToWatch">The actor to watch.</param> /// <returns>The actor to watch, i.e. the parameter <paramref name="actorToWatch"/></returns> public ActorRef Watch(ActorRef actorToWatch) { _testActor.Tell(new TestActor.Watch(actorToWatch)); return(actorToWatch); }
public SendEventImpl(ActorRef tBrokerAct) { _tBrokerAct = tBrokerAct; }
public ChatClient(IActorSystem system, string user, string room) { this.user = system.ActorOf <ChatUser>(user); this.room = system.StreamOf <SimpleMessageStreamProvider>(room); }
public bool Contains(ActorRef actor) { ChildRestartStats stats; return TryGetByRef(actor, out stats); }
public ActorRegisteredImpl(ActorRegistry registry, ActorRef actor, Guid key) { Registry = registry; Instance = actor; Key = key; }
/// <summary> /// Directly inject messages into actor receive behavior. Any exceptions /// thrown will be available to you, while still being able to use /// become/unbecome. /// </summary> /// <param name="message">The message.</param> /// <param name="sender">The sender.</param> public void Receive(object message, ActorRef sender = null) { _internalRef.Receive(message, sender); }
/// <summary> /// Registers this actor to be a death monitor of the provided ActorRef /// This means that this actor will get a Terminated()-message when the provided actor /// is permanently terminated. /// Returns the same ActorRef that is provided to it, to allow for cleaner invocations. /// </summary> /// <param name="subject">The subject to watch.</param> /// <returns>Returns the same ActorRef that is provided to it, to allow for cleaner invocations.</returns> public void Watch(ActorRef subject) { _internalRef.Watch(subject); }
protected TestActorRefBase(ActorSystem system, Props actorProps, ActorRef supervisor = null, string name = null) { _internalRef = InternalTestActorRef.Create(system, actorProps, supervisor, name); }
public TerminatingChildrenContainer(IImmutableMap <string, ChildStats> children, ActorRef toDie, SuspendReason reason) : this(children, ImmutableTreeSet <ActorRef> .Create(toDie), reason) { //Intentionally left blank }
public bool Equals(ActorRef other) { return(_internalRef.Equals(other)); }
protected void watch(ActorRef @ref) { Watch(@ref); }
/// <summary> /// Deregisters this actor from being a death monitor of the provided ActorRef /// This means that this actor will not get a Terminated()-message when the provided actor /// is permanently terminated. /// Returns the same ActorRef that is provided to it, to allow for cleaner invocations. /// </summary> /// <returns>Returns the same ActorRef that is provided to it, to allow for cleaner invocations.</returns> /// <param name="subject">The subject to unwatch.</param> public void Unwatch(ActorRef subject) { _internalRef.Unwatch(subject); }
protected Terminated expectTerminated(ActorRef @ref) { return(ExpectTerminated(@ref)); }
public KillableActor(ActorRef testActor) { this.testActor = testActor; }
public ActorAssociationEventListener(ActorRef actor) { Actor = actor; }
public SupervisorTestActor(ActorRef testActor) { this.testActor = testActor; }
public abstract ChildrenContainer Remove(ActorRef child);
public BecomeActor(ActorRef testActor) { this.testActor = testActor; }
public ActorHandleEventListener(ActorRef actor) { Actor = actor; }
public RewatchRemote(ActorRef watchee, ActorRef watcher) : base(watchee, watcher) { }
public ChatClient(IActorSystem system, string user, string room) { this.user = system.ActorOf<ChatUser>(user); this.room = system.StreamOf("sms", room); }
protected WatchCommand(ActorRef watchee, ActorRef watcher) { _watchee = watchee; _watcher = watcher; }
private static string GetActorRefLogSource(ActorRef actorRef) { return(actorRef.Path.ToString()); //TODO: Include systems address? }
/// <summary> /// Tells the internal. /// </summary> /// <param name="message">The message.</param> /// <param name="sender">The sender.</param> protected override void TellInternal(object message, ActorRef sender) { OnReceive(message); }
public ActorRef RegisterReadOnlyEndpoint(Address address, ActorRef endpoint) { addressToReadonly.Add(address, endpoint); readonlyToAddress.Add(endpoint, address); return(endpoint); }
/// <summary> /// Sends a message to this actor with the specified sender. /// </summary> /// <param name="message">The message.</param> /// <param name="sender">The sender</param> public void Tell(object message, ActorRef sender) { _internalRef.Tell(message, sender); }