本文整理汇总了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);
}
示例2: MessageService
public MessageService(IBinarySerializer binarySerializer)
{
_remotingClient = new SocketRemotingClient(Settings.BrokerAddress, Settings.BrokerPort);
_remotingClient.Connect();
_remotingClient.Start();
_binarySerializer = binarySerializer;
}
示例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();
}
示例4: QueryTopicConsumeInfoRequestHandler
public QueryTopicConsumeInfoRequestHandler()
{
_binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
_offsetManager = ObjectContainer.Resolve<IOffsetManager>();
_queueService = ObjectContainer.Resolve<IQueueService>();
_consumerManager = ObjectContainer.Resolve<ConsumerManager>();
}
示例5: QueryConsumerInfoRequestHandler
public QueryConsumerInfoRequestHandler()
{
_binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
_offsetStore = ObjectContainer.Resolve<IConsumeOffsetStore>();
_consumerManager = ObjectContainer.Resolve<ConsumerManager>();
_queueService = ObjectContainer.Resolve<IQueueStore>();
}
示例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);
}
示例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>();
}
示例8: SendMessageRequestHandler
public SendMessageRequestHandler(BrokerController brokerController)
{
_brokerController = brokerController;
_messageService = ObjectContainer.Resolve<IMessageService>();
_binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
_logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().Name);
}
示例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));
}
示例10: EventStoreHolder
EventStoreHolder(IHostConfiguration configuration, IBinarySerializer serializer)
{
var ipEndpoint = new IPEndPoint(configuration.EventStoreIp, configuration.EventStorePort);
_connection = EventStoreConnection.Create(ipEndpoint);
_serializer = serializer;
}
示例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;
}
示例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);
}
示例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>();
}
示例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);
}
示例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;
}