Beispiel #1
0
        private void OnInitialize(Initialize msg)
        {
            Log.Info("{@Event}", msg);

            ack = ClusterBroadcast.Ask <Routees>(new GetRoutees()).Result.Members.Count();

            Context.SetReceiveTimeout(TimeSpan.FromSeconds(3));

            ClusterBroadcast.Tell(new SvcDiscovery.GetServices());
        }
Beispiel #2
0
        private void OnInstanceStarted(SvcDiscovery.InstanceStarted msg)
        {
            Log.Info("{@Event}", msg);

            var svc        = Services.SingleOrDefault(x => x.ClusterAddress.Equals(msg.ClusterAddress));
            var newService = svc != null;

            svc = new Service(msg.ServiceName, msg.ServiceEndpoint, msg.ClusterAddress);

            if (newService)
            {
                Services.Add(svc);
            }

            ClusterBroadcast.Tell(new CommitService(svc), Self);

            //todo: Notify API Gateways
        }