static void Main(string[] args) { var protoRegistration = new Protoreg.ProtoRegistration(); protoRegistration.RegisterAssembly(typeof(SimpleObject)); protoreg = new Protoreg.ProtoregSerializer(protoRegistration); protoreg.Build(); var simpleObject = new SimpleObject() { IntProp = 1000, StringProp = "Test string" }; var complex = new ComplexObjectGraph() { IntProp = 1001, StringProp = "test", Nested = new List <SimpleObject>() }; //MeasureDeserialization("Deserialization Simple Object 1000000 times ", simpleObject, 1000000); //MeasureSerialization("Serializing Simple Object 1000000 times ", simpleObject, 1000000); RuntimeTypeModel.Default.Add(typeof(object), true).AddSubType(500, typeof(SimpleObject)); MeasureDeserialization("Deserialization Complex Object 1000000 times ", complex, 100000); MeasureSerialization("Serializing Complex Object 1000000 times ", complex, 100000); Console.ReadLine(); }
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); }
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(); }
public WorkManagerConfigurator(IUpdateState workManager, ProtoregSerializer protoregSerializer) { IMessageSerializer massTransitSerializer = new MassTransitSerializer(protoregSerializer); mngr = new WorkManager(workManager, new RabbitMqManagerStateRepository(protoregSerializer)); serviceBusManager = ServiceBusFactory.New(sbc => { sbc.ReceiveFrom("rabbitmq://localhost/AsyncWork-WorkDone"); sbc.UseRabbitMq(); sbc.SetPurgeOnStartup(false); sbc.SetDefaultSerializer(massTransitSerializer); sbc.SetConcurrentConsumerLimit(1); sbc.Subscribe(subs => { subs.Instance(mngr); }); }); }
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(); }
public RabbitMqManagerStateRepository(ProtoregSerializer serializer) { RabbitMqStore = new RabbitMqStore<ManagerState>("AsyncWork-StateRepository", serializer); }
public static void Boot() { try { log4net.Config.XmlConfigurator.Configure(); log.Debug("[QuickBlox] - log4net was configured."); LoadConnectionStringAndDatabaseName(); log.DebugFormat("[QuickBlox] - Connection string loaded: '{0}'.", connectionString); #if DEBUG DatabaseManager.DeleteDatabase(connectionString); Process.Start(@"C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.1.5\sbin\rabbitmqctl.bat", "stop_app"); Thread.Sleep(1000); Process.Start(@"C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.1.5\sbin\rabbitmqctl.bat", "reset"); Thread.Sleep(1000); Process.Start(@"C:\Program Files (x86)\RabbitMQ Server\rabbitmq_server-3.1.5\sbin\rabbitmqctl.bat", "start_app"); Thread.Sleep(1000); #endif isNewInstance = CreateDatabaseIfNotExists(); log.Debug("[QuickBlox] - Database initialized."); protoregSerializer = BuildProtoregSerializer(); log.Debug("[QuickBlox] - Protoreg Serializer was configured."); nhSessionFactory = BuildNHibernateSessionFacotory(); log.Debug("[QuickBlox] - NHibernate SessionFactory was configured."); if (isNewInstance) { log4net.Config.XmlConfigurator.Configure(); log.Debug("[QuickBlox] - log4net was configured."); } new Statsd(new XmlConfiguration()); log.Debug("[QuickBlox] - StatsD was configured."); quickbloxCfg = QuickBloxIntegrationConfiguration.Load(Assembly.GetAssembly(typeof(TextMessageSent))); log.Debug("[QuickBlox] - QuickBloxIntegration was configured."); qbSessionFacotry = BuildQuickBloxSessionFactory(); log.Debug("[QuickBlox] - QuickBloxSessionFactory was configured."); messageBus = BuildMessageBus(); log.Debug("[QuickBlox] - MassTransit MessageBus was configured."); marketVisionQueue = new PersistentEventSource(PersistentEventSource.ProjectionsQueueName, protoregSerializer); eventStoreRecievingBus = BuildEventStoreMessageBus(); log.Debug("[QuickBlox] - EventStore ConsumingBus was configured."); quickBloxCrawler = BuildQuickBloxCrawler(); log.Debug("[QuickBlox] - QuickBloxCrawler was configured."); } catch (Exception ex) { log.Fatal("[QuickBlox] - Cannot boot the service", ex); throw ex; } }
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; }
public WorkProcessorsConfigurator(IProcessState workProcessor, ProtoregSerializer protoregSerializer, int conccurentNumberOfProcessors = 0) { this.workProcessor = workProcessor; this.conccurentNumberOfProcessors = conccurentNumberOfProcessors; massTransitSerializer = new MassTransitSerializer(protoregSerializer); }