Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            ProtoRegistration registration = new ProtoRegistration();
            registration.RegisterAssembly<ManagerState>();
            registration.RegisterCommonType<Work>(); // Register contract
            ProtoregSerializer protoregSerializer = new ProtoregSerializer(registration);
            protoregSerializer.Build();

            var processor = new WorkProcessorsConfigurator(new MyWorkProcessor(), protoregSerializer);
            processor.Start();
            Console.ReadLine();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            ProtoRegistration registration = new ProtoRegistration();
            registration.RegisterAssembly<ManagerState>();
            registration.RegisterCommonType<Work>(); // Register contract
            ProtoregSerializer protoregSerializer = new ProtoregSerializer(registration);
            protoregSerializer.Build();

            var pool = new WorkManagerConfigurator(new MyWorkManager(), protoregSerializer);
            for (int i = 0; i < 10; i++)
            {
                pool.AddWork(new Work(i));
            }

            pool.Start();

            Console.WriteLine("Console writeline");
            Console.ReadLine();
            pool.Stop();
        }
 private static ProtoregSerializer BuildProtoregSerializer()
 {
     var registration = new ProtoRegistration();
     registration.RegisterAssembly<TextMessageSent>();
     registration.RegisterAssembly<WorkManager>();
     registration.RegisterAssembly<PullFromQuickBlox>();
     // registration.RegisterCommonType<IEvent>();
     registration.RegisterCommonType<List<IEvent>>();
     registration.RegisterCommonType<Queue<Guid>>();
     registration.RegisterCommonType<Fault<UncommittedEvents>>();
     registration.RegisterCommonType<Fault<UserLoggedIn>>();
     registration.RegisterCommonType<Fault<BrokenEvent>>();
     registration.RegisterCommonType<Fault<AsyncWorkDone>>();
     registration.RegisterCommonType<Fault<PendingWork>>();
     registration.RegisterCommonType<Fault<IEvent>>();
     var serializer = new ProtoregSerializer(registration);
     serializer.Build();
     return serializer;
 }