当前位置: 首页>>代码示例>>C#>>正文


C# IBinarySerializer类代码示例

本文整理汇总了C#中IBinarySerializer的典型用法代码示例。如果您正苦于以下问题:C# IBinarySerializer类的具体用法?C# IBinarySerializer怎么用?C# IBinarySerializer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IBinarySerializer类属于命名空间,在下文中一共展示了IBinarySerializer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Consumer

        public Consumer(string id, string groupName, ConsumerSetting setting)
        {
            if (id == null)
            {
                throw new ArgumentNullException("id");
            }
            if (groupName == null)
            {
                throw new ArgumentNullException("groupName");
            }
            Id = id;
            GroupName = groupName;
            Setting = setting ?? new ConsumerSetting();

            _lockObject = new object();
            _subscriptionTopics = new List<string>();
            _topicQueuesDict = new ConcurrentDictionary<string, IList<MessageQueue>>();
            _pullRequestQueue = new BlockingCollection<PullRequest>(new ConcurrentQueue<PullRequest>());
            _pullRequestDict = new ConcurrentDictionary<string, PullRequest>();
            _consumingMessageQueue = new BlockingCollection<ConsumingMessage>(new ConcurrentQueue<ConsumingMessage>());
            _messageRetryQueue = new BlockingCollection<ConsumingMessage>(new ConcurrentQueue<ConsumingMessage>());
            _handlingMessageDict = new ConcurrentDictionary<long, ConsumingMessage>();
            _taskIds = new List<int>();
            _remotingClient = new SocketRemotingClient(Setting.BrokerAddress, Setting.BrokerPort);
            _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
            _scheduleService = ObjectContainer.Resolve<IScheduleService>();
            _allocateMessageQueueStragegy = ObjectContainer.Resolve<IAllocateMessageQueueStrategy>();
            _executePullRequestWorker = new Worker("Consumer.ExecutePullRequest", ExecutePullRequest);
            _handleMessageWorker = new Worker("Consumer.HandleMessage", HandleMessage);
            _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
        }
开发者ID:edgevagrant,项目名称:equeue,代码行数:31,代码来源:Consumer.cs

示例2: MessageService

 public MessageService(IBinarySerializer binarySerializer)
 {
     _remotingClient = new SocketRemotingClient(Settings.BrokerAddress, Settings.BrokerPort);
     _remotingClient.Connect();
     _remotingClient.Start();
     _binarySerializer = binarySerializer;
 }
开发者ID:edgevagrant,项目名称:equeue,代码行数:7,代码来源:MessageService.cs

示例3: ClientService

        public ClientService(ClientSetting setting, Producer producer, Consumer consumer)
        {
            Ensure.NotNull(setting, "setting");
            if (producer == null && consumer == null)
            {
                throw new ArgumentException("producer or consumer must set at least one of them.");
            }
            else if (producer != null && consumer != null)
            {
                throw new ArgumentException("producer or consumer cannot set both of them.");
            }

            Interlocked.Increment(ref _instanceNumber);

            _producer = producer;
            _consumer = consumer;
            _setting = setting;
            _clientId = BuildClientId(setting.ClientName);
            _brokerConnectionDict = new ConcurrentDictionary<string, BrokerConnection>();
            _topicMessageQueueDict = new ConcurrentDictionary<string, IList<MessageQueue>>();
            _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
            _jsonSerializer = ObjectContainer.Resolve<IJsonSerializer>();
            _scheduleService = ObjectContainer.Resolve<IScheduleService>();
            _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
            _nameServerRemotingClientList = RemotingClientUtils.CreateRemotingClientList(_setting.NameServerList, _setting.SocketSetting).ToList();
        }
开发者ID:Aaron-Liu,项目名称:equeue,代码行数:26,代码来源:ClientService.cs

示例4: QueryTopicConsumeInfoRequestHandler

 public QueryTopicConsumeInfoRequestHandler()
 {
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _offsetManager = ObjectContainer.Resolve<IOffsetManager>();
     _queueService = ObjectContainer.Resolve<IQueueService>();
     _consumerManager = ObjectContainer.Resolve<ConsumerManager>();
 }
开发者ID:wangjiepower,项目名称:equeue,代码行数:7,代码来源:QueryTopicConsumeInfoRequestHandler.cs

示例5: QueryConsumerInfoRequestHandler

 public QueryConsumerInfoRequestHandler()
 {
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _offsetStore = ObjectContainer.Resolve<IConsumeOffsetStore>();
     _consumerManager = ObjectContainer.Resolve<ConsumerManager>();
     _queueService = ObjectContainer.Resolve<IQueueStore>();
 }
开发者ID:haoas,项目名称:equeue,代码行数:7,代码来源:QueryConsumerInfoRequestHandler.cs

示例6: Consumer

        public Consumer(string groupName, ConsumerSetting setting, string consumerName = null)
        {
            if (groupName == null)
            {
                throw new ArgumentNullException("groupName");
            }

            Name = consumerName;
            GroupName = groupName;
            Setting = setting ?? new ConsumerSetting();

            if (Setting.NameServerList == null || Setting.NameServerList.Count() == 0)
            {
                throw new Exception("Name server address is not specified.");
            }

            _subscriptionTopics = new Dictionary<string, HashSet<string>>();
            _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
            _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);

            var clientSetting = new ClientSetting
            {
                ClientName = Name,
                ClusterName = Setting.ClusterName,
                NameServerList = Setting.NameServerList,
                SocketSetting = Setting.SocketSetting,
                OnlyFindMasterBroker = true,
                SendHeartbeatInterval = Setting.HeartbeatBrokerInterval,
                RefreshBrokerAndTopicRouteInfoInterval = Setting.RefreshBrokerAndTopicRouteInfoInterval
            };
            _clientService = new ClientService(clientSetting, null, this);
            _pullMessageService = new PullMessageService(this, _clientService);
            _commitConsumeOffsetService = new CommitConsumeOffsetService(this, _clientService);
            _rebalanceService = new RebalanceService(this, _clientService, _pullMessageService, _commitConsumeOffsetService);
        }
开发者ID:Aaron-Liu,项目名称:equeue,代码行数:35,代码来源:Consumer.cs

示例7: Consumer

        public Consumer(string groupName, ConsumerSetting setting)
        {
            if (groupName == null)
            {
                throw new ArgumentNullException("groupName");
            }
            GroupName = groupName;
            Setting = setting ?? new ConsumerSetting();

            _lockObject = new object();
            _subscriptionTopics = new Dictionary<string, HashSet<string>>();
            _topicQueuesDict = new ConcurrentDictionary<string, IList<MessageQueue>>();
            _pullRequestDict = new ConcurrentDictionary<string, PullRequest>();
            _remotingClient = new SocketRemotingClient(Setting.BrokerAddress, Setting.SocketSetting, Setting.LocalAddress);
            _adminRemotingClient = new SocketRemotingClient(Setting.BrokerAdminAddress, Setting.SocketSetting, Setting.LocalAdminAddress);
            _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
            _scheduleService = ObjectContainer.Resolve<IScheduleService>();
            _allocateMessageQueueStragegy = ObjectContainer.Resolve<IAllocateMessageQueueStrategy>();
            _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);

            _remotingClient.RegisterConnectionEventListener(new ConnectionEventListener(this));

            if (Setting.MessageHandleMode == MessageHandleMode.Sequential)
            {
                _consumingMessageQueue = new BlockingCollection<ConsumingMessage>();
                _consumeMessageWorker = new Worker("ConsumeMessage", () => HandleMessage(_consumingMessageQueue.Take()));
            }
            _messageRetryQueue = new BlockingCollection<ConsumingMessage>();
        }
开发者ID:uliian,项目名称:equeue,代码行数:29,代码来源:Consumer.cs

示例8: SendMessageRequestHandler

 public SendMessageRequestHandler(BrokerController brokerController)
 {
     _brokerController = brokerController;
     _messageService = ObjectContainer.Resolve<IMessageService>();
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().Name);
 }
开发者ID:kouweizhong,项目名称:equeue,代码行数:7,代码来源:SendMessageRequestHandler.cs

示例9: Consumer

        public Consumer(string groupName, ConsumerSetting setting)
        {
            if (groupName == null)
            {
                throw new ArgumentNullException("groupName");
            }
            GroupName = groupName;
            Setting = setting ?? new ConsumerSetting();

            _lockObject = new object();
            _subscriptionTopics = new Dictionary<string, HashSet<string>>();
            _topicQueuesDict = new ConcurrentDictionary<string, IList<MessageQueue>>();
            _pullRequestQueue = new BlockingCollection<PullRequest>(new ConcurrentQueue<PullRequest>());
            _pullRequestDict = new ConcurrentDictionary<string, PullRequest>();
            _messageRetryQueue = new BlockingCollection<ConsumingMessage>(new ConcurrentQueue<ConsumingMessage>());
            _taskFactory = new TaskFactory(new LimitedConcurrencyLevelTaskScheduler(Setting.ConsumeThreadMaxCount));
            _remotingClient = new SocketRemotingClient(Setting.BrokerAddress, Setting.SocketSetting, Setting.LocalAddress);
            _adminRemotingClient = new SocketRemotingClient(Setting.BrokerAdminAddress, Setting.SocketSetting, Setting.LocalAdminAddress);
            _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
            _scheduleService = ObjectContainer.Resolve<IScheduleService>();
            _allocateMessageQueueStragegy = ObjectContainer.Resolve<IAllocateMessageQueueStrategy>();
            _executePullRequestWorker = new Worker("ExecutePullRequest", ExecutePullRequest);
            _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);

            _remotingClient.RegisterConnectionEventListener(new ConnectionEventListener(this));
        }
开发者ID:riiiqpl,项目名称:equeue,代码行数:26,代码来源:Consumer.cs

示例10: EventStoreHolder

        EventStoreHolder(IHostConfiguration configuration, IBinarySerializer serializer)
        {
            var ipEndpoint = new IPEndPoint(configuration.EventStoreIp, configuration.EventStorePort);

            _connection = EventStoreConnection.Create(ipEndpoint);
            _serializer = serializer;
        }
开发者ID:PQ4NOEH,项目名称:.NET-recipes,代码行数:7,代码来源:EventStoreHolder.cs

示例11: MessageService

 public MessageService(IBinarySerializer binarySerializer, IScheduleService scheduleService, SendEmailService sendEmailService)
 {
     _nameServerRemotingClientList = CreateRemotingClientList(Settings.NameServerList);
     _clusterBrokerDict = new ConcurrentDictionary<string, IList<BrokerClient>>();
     _binarySerializer = binarySerializer;
     _scheduleService = scheduleService;
     _sendEmailService = sendEmailService;
 }
开发者ID:Aaron-Liu,项目名称:equeue,代码行数:8,代码来源:MessageService.cs

示例12: EventPublisher

 public EventPublisher(ProducerSetting setting, string id)
 {
     _producer = new Producer(setting, id);
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _eventTopicProvider = ObjectContainer.Resolve<IEventTopicProvider>();
     _eventTypeCodeProvider = ObjectContainer.Resolve<IEventTypeCodeProvider>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().Name);
 }
开发者ID:key-value,项目名称:enode,代码行数:8,代码来源:EventPublisher.cs

示例13: SqlServerEventStore

 /// <summary>Parameterized constructor.
 /// </summary>
 public SqlServerEventStore(string connectionString, string eventTable, string commitIndexName, string versionIndexName)
 {
     _connectionString = connectionString;
     _eventTable = eventTable;
     _commitIndexName = commitIndexName;
     _versionIndexName = versionIndexName;
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _connectionFactory = ObjectContainer.Resolve<IDbConnectionFactory>();
 }
开发者ID:key-value,项目名称:enode,代码行数:11,代码来源:SqlServerEventStore.cs

示例14: ClusterManager

 public ClusterManager(NameServerController nameServerController)
 {
     _scheduleService = ObjectContainer.Resolve<IScheduleService>();
     _jsonSerializer = ObjectContainer.Resolve<IJsonSerializer>();
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _clusterDict = new ConcurrentDictionary<string, Cluster>();
     _nameServerController = nameServerController;
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
 }
开发者ID:Aaron-Liu,项目名称:equeue,代码行数:9,代码来源:ClusterManager.cs

示例15: EventConsumer

 public EventConsumer(string id, ConsumerSetting setting, string groupName, DomainEventHandledMessageSender domainEventHandledMessageSender)
 {
     _consumer = new Consumer(id, setting, string.IsNullOrEmpty(groupName) ? typeof(EventConsumer).Name + "Group" : groupName);
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _eventTypeCodeProvider = ObjectContainer.Resolve<IEventTypeCodeProvider>();
     _eventProcessor = ObjectContainer.Resolve<IEventProcessor>();
     _messageContextDict = new ConcurrentDictionary<string, IMessageContext>();
     _domainEventHandledMessageSender = domainEventHandledMessageSender;
 }
开发者ID:key-value,项目名称:enode,代码行数:9,代码来源:EventConsumer.cs


注:本文中的IBinarySerializer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。