/// <summary> /// TBD /// </summary> /// <param name="ev">TBD</param> public void Notify(IHandleEvent ev) { if (!_gremlinAdapter.ShouldDropInbound(WrappedHandle.RemoteAddress, ev, "handler.notify")) { _upstreamListener.Notify(ev); } }
/// <summary> /// Constructor /// </summary> /// <param name="parent">A local event handler to send messages to</param> /// <param name="network">The network connection to use for handling events</param> public NetLogic(IHandleEvent parent, NetPlayer network) : base(parent, null, null) { _network = network; network.parent = this; _map = new Map(); }
public Dispatching_events() { _resolver = Substitute.For <IResolver>(); _executor = Substitute.For <IExecuteEvents>(); _handler = Substitute.For <IHandleEvent <TestEvent> >(); _logger = Substitute.For <ILogger>(); }
public AkkaProtocolSpec() { testEnvelope = codec.ConstructMessage(localAkkaAddress, testActor, testMsg); testMsgPdu = codec.ConstructPayload(testEnvelope); testHeartbeat = new InboundPayload(codec.ConstructHeartbeat()); testPayload = new InboundPayload(testMsgPdu); }
public async Task StartAsync(IHandleEvent handler, CancellationToken cancellationToken) { var handlerInstance = (IHandleEvent <TEvent>)handler; _backgroundEventHandler = new BackgroundEventHandler <TEvent>(handlerInstance, _client); await _backgroundEventHandler.StartAsync(cancellationToken); }
public static void Notify(IConnection channel, IHandleEvent msg) { IHandleEventListener listener; if (_channelActors.TryGetValue(channel, out listener)) { listener.Notify(msg); } }
public AkkaProtocolSpec() : base(@"akka.test.default-timeout = 1.5 s") { testEnvelope = codec.ConstructMessage(localAkkaAddress, TestActor, testMsg); testMsgPdu = codec.ConstructPayload(testEnvelope); testHeartbeat = new InboundPayload(codec.ConstructHeartbeat()); testPayload = new InboundPayload(testMsgPdu); }
public override void Setup() { base.Setup(); testEnvelope = codec.ConstructMessage(localAkkaAddress, testActor, testMsg); testMsgPdu = codec.ConstructPayload(testEnvelope); testHeartbeat = new InboundPayload(codec.ConstructHeartbeat()); testPayload = new InboundPayload(testMsgPdu); }
public Logic(IHandleEvent parent, Map map = null, Random random = null) { _parent = parent; if (map != null) { _map = map; } if (random == null) _random = new Random(); else _random = random; }
public void Unsubscribe <T>(IHandleEvent <T> handler) { List <WeakReference> handlers; lock (_allHandlers) { if (_allHandlers.TryGetValue(typeof(T), out handlers) == true) { handlers.RemoveAll(wr => ReferenceEquals(wr.Target, handler)); } } }
public DemoPublisher(IHandleEvent <FundsDepositedEvent> handleDeposit, IHandleEvent <FundsWithdrawalEvent> handleWithdrawal) { _switch = new Dictionary <Type, Action <IEvent> > { { typeof(FundsDepositedEvent), x => { handleDeposit.Handle((FundsDepositedEvent)x); } }, { typeof(FundsWithdrawalEvent), x => { handleWithdrawal.Handle((FundsWithdrawalEvent)x); } } }; }
public void Subscribe <T>(IHandleEvent <T> handler) { List <WeakReference> handlers; lock (_allHandlers) { if (_allHandlers.TryGetValue(typeof(T), out handlers) == false) { handlers = new List <WeakReference>(); _allHandlers.Add(typeof(T), handlers); } handlers.Add(new WeakReference(handler)); } }
private void Handle <TEvent>(TEvent evnt, IHandleEvent <TEvent> handler) where TEvent : IEvent { try { handler.Handle(evnt); } catch { } finally { var disposable = handler as IDisposable; if (disposable != null) { disposable.Dispose(); } } }
/// <summary> /// The constructor for the logic behind the game /// </summary> /// <param name="parent"></param> /// <param name="map">The map object which will contain the rooms</param> /// <param name="_random">A random</param> public PureLogic(IHandleEvent parent, Map map = null, Random _random = null) : base(parent, map, _random) { if (!System.IO.File.Exists("save\\auto\\room1.xml")) { GenerateMaps(); } string path = "room1.xml"; if (File.Exists("save\\auto\\GameData")) path = File.ReadAllText("save\\auto\\GameData"); if (path.IndexOf(Environment.NewLine) > 0) { path = path.Substring(0, path.IndexOf(Environment.NewLine)); } if (File.Exists("save\\auto\\saved" + (string)path)) _map = new Map(this, "saved" + (string)path); else _map = new Map(this, (string)path); }
public AkkaProtocolSpec(ITestOutputHelper helper) : base(@" akka.actor.provider = remote akka.test.default-timeout = 1.5 s", helper) { codec = new AkkaPduProtobuffCodec(Sys); testEnvelope = codec.ConstructMessage(_localAkkaAddress, TestActor, testMsg); testMsgPdu = codec.ConstructPayload(testEnvelope); testHeartbeat = new InboundPayload(codec.ConstructHeartbeat()); testPayload = new InboundPayload(testMsgPdu); config = ConfigurationFactory.ParseString( @"akka{ remote { transport-failure-detector { implementation-class = ""Akka.Remote.PhiAccrualFailureDetector, Akka.Remote"" threshold = 7.0 max-sample-size = 100 min-std-deviation = 100 ms acceptable-heartbeat-pause = 3 s heartbeat-interval = 1 s } backoff-interval = 1 s require-cookie = off secure-cookie = ""abcde"" shutdown-timeout = 5 s startup-timeout = 5 s use-passive-connections = on }}").WithFallback(Sys.Settings.Config); }
public void Notify(IHandleEvent ev) { Actor.Tell(ev); }
public void Notify(IHandleEvent ev) { _handler(ev); }
public BackgroundEventHandler(IHandleEvent <TEvent> handler, ISubscriptionClient subscriptionClient) { _handler = handler; _subscriptionClient = subscriptionClient; }
public void Notify(IHandleEvent ev) { if (!_gremlinAdapter.ShouldDropInbound(WrappedHandle.RemoteAddress, ev, "handler.notify")) { _upstreamListener.Notify(ev); } }
protected void NotifyListener(IHandleEvent msg) { _listener?.Notify(msg); }
public TestEventHapenedOrderedStreamHandler(IHandleEvent <TestEventHappened> handleOrderCreated) : base(handleOrderCreated) { }
protected OrderedStreamHandler(IHandleEvent <TEventType> handleOrderCreated) { _handleOrderCreated = handleOrderCreated; _stream = GetStreamInfo(); }
/// <summary> /// Notify the Actor about an <see cref="IHandleEvent"/> message. /// </summary> /// <param name="ev">The <see cref="IHandleEvent"/> message to notify the Actor about</param> public void Notify(IHandleEvent ev) { Actor.Tell(ev); }
public EventCallback(IHandleEvent receiver, MulticastDelegate @delegate) { Receiver = receiver; Delegate = @delegate; }
public MatEventCallback(IHandleEvent receiver, Func <EventCallback <T> > sourceEventCallbackFunc) { _receiver = receiver; _sourceEventCallbackFunc = sourceEventCallbackFunc; }
public IDisposable Subscribe <T>(IHandleEvent <T> handler) where T : IDomainEvent { return(Subscribe((IObserver <IDomainEvent>)handler)); }
/// <summary> /// Constructor for a loading a map from a file /// </summary> /// <param name="parent">An event handler to pass events to</param> /// <param name="filename">Filename of XML-file containing map data</param> /// <param name="playerPos">Coordinates of player on map</param> public Map(IHandleEvent parent, string filename = "", Backend.Coords playerPos = null) : this() { _parent = parent; Load(filename, playerPos, true); }
public HandleEventAsynchronouslyDecorator(Container container, Func <IHandleEvent <TEvent> > factory) { _container = container; _factory = factory; _handler = _factory(); }
protected void NotifyListener(IHandleEvent e) => this.listener?.Notify(e);
public EventCache(T @event, IHandleEvent <T> handler) { _event = @event; _handler = handler; }
public void Register(IHandleEvent handler) { lock(_eventList) _eventList.Add(handler); }