public static void StartEventHosts()
 {
     inProcessHost = new BurstingEventSystemHost(6483, "akkaSystem", "local", "127.0.0.1:6483", 3600, _eventsPerDocument);
     inProcessHost.Start();
     outOfProcessClusterMembersHost = new OutOfProcessProcessClusterMember(_eventsPerDocument);
     outOfProcessClusterMembersHost.Start();
     Thread.Sleep(TimeSpan.FromSeconds(1));
 }
示例#2
0
        public static void Main(string[] args)
        {
            var akkaSystemName     = GetValueFromCommandLine("akkaSystemName", args);
            var seedNodes          = GetValueFromCommandLine("seedNodes", args);
            var akkaPortNumber     = GetIntFromCommandLine(args, "portNumber");
            var entriesPerDocument = GetIntFromCommandLine(args, "entriesPerDocument");
            var persistence        = GetValueFromCommandLine("persistence", args);

            var eventSystemHost        = new BurstingEventSystemHost(akkaPortNumber, akkaSystemName, persistence, seedNodes, 3601, entriesPerDocument);
            var EventRaisingController = eventSystemHost.Get <EventRaisingController>();

            eventSystemHost.Start();

            Console.Title = string.Join(" ", args);
            Thread.Sleep(TimeSpan.FromSeconds(5));

            var subscriptionId = new SubscriptionId(GetValueFromCommandLine("subscriptionId", args));

            if (!string.IsNullOrEmpty(subscriptionId.Id))
            {
                Console.WriteLine("Getting subscriptionId");
                ISubscriptionManager shardedSubscriptionManager = eventSystemHost.Get <ISubscriptionManager>();

                var currentSubscription =
                    shardedSubscriptionManager.GetSubscriptionDetails(new SubscriptionQuery(subscriptionId)).Result;

                if (currentSubscription is NullSubscription)
                {
                    _subscriptionMessage = new SubscriptionMessage(
                        new AtomNotificationChannel(),
                        subscriptionId,
                        new AllEventMatcher());

                    shardedSubscriptionManager.CreateSubscription(_subscriptionMessage);
                    Thread.Sleep(1000);
                }

                Thread.Sleep(1000);

                IEventPublisher notifier = eventSystemHost.Get <IEventPublisher>();

                var i = 0;
                while (true)
                {
                    notifier.PublishMessage(new DummyDomainEvent(akkaPortNumber + ":" + (++i).ToString()));
                    LogManager.GetLogger("").Info("Raising event with id" + i);
                }
            }

            while (true)
            {
                Thread.Sleep(TimeSpan.FromSeconds(5));
            }
        }