示例#1
0
        public ProtoregSpeedTest()
        {
            var protoReg = new ProtoRegistration();
            protoReg.RegisterCommonType<ProtoregTestObject>();
            serializer = new ProtoregSerializer(protoReg);
            serializer.Build();

            testObject = new ProtoregTestObject(Guid.NewGuid(), "string", Int32.MaxValue, long.MaxValue);
            testObjectBytes = Serialize(testObject);
        }
示例#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 processor = new WorkProcessorsConfigurator(new MyWorkProcessor(), protoregSerializer);
            processor.Start();
            Console.ReadLine();
        }
示例#3
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;
 }