Example #1
0
        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);
        }
Example #2
0
 public MessageService(IBinarySerializer binarySerializer)
 {
     _remotingClient = new SocketRemotingClient(Settings.BrokerAddress, Settings.BrokerPort);
     _remotingClient.Connect();
     _remotingClient.Start();
     _binarySerializer = binarySerializer;
 }
Example #3
0
        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();
        }
Example #4
0
        EventStoreHolder(IHostConfiguration configuration, IBinarySerializer serializer)
        {
            var ipEndpoint = new IPEndPoint(configuration.EventStoreIp, configuration.EventStorePort);

            _connection = EventStoreConnection.Create(ipEndpoint);
            _serializer = serializer;
        }
 public QueryConsumerInfoRequestHandler()
 {
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _offsetStore = ObjectContainer.Resolve<IConsumeOffsetStore>();
     _consumerManager = ObjectContainer.Resolve<ConsumerManager>();
     _queueService = ObjectContainer.Resolve<IQueueStore>();
 }
Example #6
0
        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));
        }
 public SendMessageRequestHandler(BrokerController brokerController)
 {
     _brokerController = brokerController;
     _messageService = ObjectContainer.Resolve<IMessageService>();
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().Name);
 }
Example #8
0
        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);
        }
Example #9
0
        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>();
        }
 public QueryTopicConsumeInfoRequestHandler()
 {
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _offsetManager = ObjectContainer.Resolve<IOffsetManager>();
     _queueService = ObjectContainer.Resolve<IQueueService>();
     _consumerManager = ObjectContainer.Resolve<ConsumerManager>();
 }
Example #11
0
 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);
 }
Example #12
0
 public MessageService(IBinarySerializer binarySerializer, IScheduleService scheduleService, SendEmailService sendEmailService)
 {
     _nameServerRemotingClientList = CreateRemotingClientList(Settings.NameServerList);
     _clusterBrokerDict = new ConcurrentDictionary<string, IList<BrokerClient>>();
     _binarySerializer = binarySerializer;
     _scheduleService = scheduleService;
     _sendEmailService = sendEmailService;
 }
Example #13
0
 /// <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>();
 }
Example #14
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="serviceEvents">ServiceEvents</param>
 /// <param name="listenerFactory">KafkaListener factory</param>
 /// <param name="serializer">Binary serializer</param>
 public KafkaHostListener(
     IServiceEvents serviceEvents,
     IKafkaListenerFactory listenerFactory,
     IBinarySerializer serializer)
 {
     _serviceEvents = serviceEvents;
     _listenerFactory = listenerFactory;
     _serializer = serializer;
 }
Example #15
0
 public CommandService(CommandResultProcessor commandResultProcessor, ProducerSetting setting, string id)
 {
     _commandResultProcessor = commandResultProcessor;
     _producer = new Producer(setting, id);
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _commandTopicProvider = ObjectContainer.Resolve<ICommandTopicProvider>();
     _commandTypeCodeProvider = ObjectContainer.Resolve<ICommandTypeCodeProvider>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().Name);
 }
Example #16
0
 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);
 }
Example #17
0
 public MessageService(IBinarySerializer binarySerializer, IScheduleService scheduleService, SendEmailService sendEmailService)
 {
     _remotingClient = new SocketRemotingClient(Settings.BrokerAddress);
     _binarySerializer = binarySerializer;
     _scheduleService = scheduleService;
     _unconsumedMessageWarnningThreshold = int.Parse(ConfigurationManager.AppSettings["unconsumedMessageWarnningThreshold"]);
     _checkUnconsumedMessageInterval = int.Parse(ConfigurationManager.AppSettings["checkUnconsumedMessageInterval"]);
     _sendEmailService = sendEmailService;
 }
Example #18
0
 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;
 }
 public CommitConsumeOffsetService(Consumer consumer, ClientService clientService)
 {
     _consumeOffsetInfoDict = new ConcurrentDictionary<string, ConsumeOffsetInfo>();
     _consumer = consumer;
     _clientService = clientService;
     _clientId = clientService.GetClientId();
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _scheduleService = ObjectContainer.Resolve<IScheduleService>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
 }
 public PullMessageRequestHandler()
 {
     _consumerManager = ObjectContainer.Resolve<ConsumerManager>();
     _suspendedPullRequestManager = ObjectContainer.Resolve<SuspendedPullRequestManager>();
     _messageService = ObjectContainer.Resolve<IMessageService>();
     _queueService = ObjectContainer.Resolve<IQueueService>();
     _offsetManager = ObjectContainer.Resolve<IOffsetManager>();
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
     EmptyResponseData = new byte[0];
 }
Example #21
0
        public RequestChannel(
            CommunicateChannelFactoryPool channelFactoryPool,
            RequestMessageContext requestMessageContext,
            IBinarySerializer binarySerializer)
        {
            _requestMessageContext = requestMessageContext;

            _channelFactoryPool = channelFactoryPool;

            _binarySerializer = binarySerializer;
        }
Example #22
0
 public CommandResultProcessor(Consumer commandExecutedMessageConsumer, Consumer domainEventHandledMessageConsumer)
 {
     _commandExecutedMessageConsumer = commandExecutedMessageConsumer;
     _domainEventHandledMessageConsumer = domainEventHandledMessageConsumer;
     _commandTaskDict = new ConcurrentDictionary<string, CommandTaskCompletionSource>();
     _processTaskDict = new ConcurrentDictionary<string, TaskCompletionSource<ProcessResult>>();
     _commandExecutedMessageLocalQueue = new BlockingCollection<CommandExecutedMessage>(new ConcurrentQueue<CommandExecutedMessage>());
     _domainEventHandledMessageLocalQueue = new BlockingCollection<DomainEventHandledMessage>(new ConcurrentQueue<DomainEventHandledMessage>());
     _commandExecutedMessageWorker = new Worker(() => ProcessExecutedCommandMessage(_commandExecutedMessageLocalQueue.Take()));
     _domainEventHandledMessageWorker = new Worker(() => ProcessDomainEventHandledMessage(_domainEventHandledMessageLocalQueue.Take()));
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
 }
Example #23
0
 public Consumer(string id, ConsumerSetting setting, string groupName)
 {
     Id = id;
     Setting = setting ?? new ConsumerSetting();
     GroupName = groupName;
     _remotingClient = new SocketRemotingClient(Setting.BrokerAddress, Setting.BrokerPort);
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _scheduleService = ObjectContainer.Resolve<IScheduleService>();
     _offsetStore = Setting.MessageModel == MessageModel.Clustering ? ObjectContainer.Resolve<IRemoteBrokerOffsetStore>() as IOffsetStore : ObjectContainer.Resolve<ILocalOffsetStore>() as IOffsetStore;
     _allocateMessageQueueStragegy = ObjectContainer.Resolve<IAllocateMessageQueueStrategy>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().Name);
 }
Example #24
0
 public Producer(ProducerSetting setting, string id)
 {
     Id = id;
     Setting = setting ?? new ProducerSetting();
     _topicQueueCountDict = new ConcurrentDictionary<string, int>();
     _taskIds = new List<int>();
     _remotingClient = new SocketRemotingClient(Setting.BrokerAddress, Setting.BrokerPort);
     _scheduleService = ObjectContainer.Resolve<IScheduleService>();
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _queueSelector = ObjectContainer.Resolve<IQueueSelector>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().Name);
 }
Example #25
0
        /// <summary>Parameterized constructor.
        /// </summary>
        /// <param name="connectionString"></param>
        /// <exception cref="ArgumentNullException"></exception>
        public MongoEventStore(string connectionString)
        {
            if (string.IsNullOrEmpty(connectionString))
            {
                throw new ArgumentNullException("connectionString");
            }

            _connectionString = connectionString;

            _eventCollectionNameProvider = ObjectContainer.Resolve<IEventCollectionNameProvider>();
            _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
            _aggregateRootTypeProvider = ObjectContainer.Resolve<IAggregateRootTypeProvider>();
        }
Example #26
0
 public RebalanceService(Consumer consumer, ClientService clientService, PullMessageService pullMessageService, CommitConsumeOffsetService commitConsumeOffsetService)
 {
     _consumer = consumer;
     _clientService = clientService;
     _clientId = clientService.GetClientId();
     _pullRequestDict = new ConcurrentDictionary<string, PullRequest>();
     _allocateMessageQueueStragegy = ObjectContainer.Resolve<IAllocateMessageQueueStrategy>();
     _pullMessageService = pullMessageService;
     _commitConsumeOffsetService = commitConsumeOffsetService;
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _scheduleService = ObjectContainer.Resolve<IScheduleService>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
 }
Example #27
0
 public DefaultCommandProssor(
     IEventStore eventStore,
     IRepository repository,
     CommandHandleProvider commandHandleProvider,
     IEventPublisher eventPublisher,
     ISnapshotStorage snapshotStorage,
     IBinarySerializer binarySerializer)
 {
     _eventStore = eventStore;
     _repository = repository;
     _commandHandleProvider = commandHandleProvider;
     _eventPublisher = eventPublisher;
     _binarySerializer = binarySerializer;
     _snapshotStorage = snapshotStorage;
 }
Example #28
0
        public PushMessageConsumer(
            CommunicateChannelFactoryPool channelPools,
            IBinarySerializer binarySerializer,
            ConsumerContext consumerContext,
            IQueueMessageHandler messageHandler)
        {
            _channelPools = channelPools;

            _consumerContext = consumerContext;

            _messageHandler = messageHandler;

            _binarySerializer = binarySerializer;

            _cancellation = new CancellationTokenSource();
        }
Example #29
0
 /// <summary>
 /// Parameterized constructor.
 /// </summary>
 public EventSourcedRepository(IEventStore eventStore,
     ISnapshotStore snapshotStore,
     ISnapshotPolicy snapshotPolicy,
     IMemoryCache cache,
     IEventBus eventBus,
     IAggregateRootFactory aggregateFactory,
     IBinarySerializer binarySerializer)
 {
     this._eventStore = eventStore;
     this._snapshotStore = snapshotStore;
     this._snapshotPolicy = snapshotPolicy;
     this._cache = cache;
     this._eventBus = eventBus;
     this._aggregateFactory = aggregateFactory;
     this._binarySerializer = binarySerializer;
     //this._textSerializer = textSerializer;
     this._logger = LogManager.GetLogger("ThinkNet");
 }
Example #30
0
        public Producer(string id, ProducerSetting setting)
        {
            if (id == null)
            {
                throw new ArgumentNullException("id");
            }
            Id = id;
            Setting = setting ?? new ProducerSetting();

            _lockObject = new object();
            _taskIds = new List<int>();
            _topicQueueIdsDict = new ConcurrentDictionary<string, IList<int>>();
            _remotingClient = new SocketRemotingClient(Setting.BrokerAddress, Setting.BrokerPort);
            _scheduleService = ObjectContainer.Resolve<IScheduleService>();
            _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
            _queueSelector = ObjectContainer.Resolve<IQueueSelector>();
            _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().FullName);
        }
 private int SetUInt16Value(IBinarySerializer serializer, BinaryWriter writer, object value)
 {
     writer.Write((ushort)value);
     return(2);
 }
Example #32
0
 public DefaultSnapshotter(IAggregateRootFactory aggregateRootFactory, ITypeCodeProvider aggregateRootTypeCodeProvider, IBinarySerializer binarySerializer)
 {
     _aggregateRootFactory          = aggregateRootFactory;
     _aggregateRootTypeCodeProvider = aggregateRootTypeCodeProvider;
     _binarySerializer = binarySerializer;
 }
Example #33
0
 public GetTopicQueueInfoRequestHandler()
 {
     _binarySerializer = ObjectContainer.Resolve <IBinarySerializer>();
     _queueStore       = ObjectContainer.Resolve <IQueueStore>();
     _offsetStore      = ObjectContainer.Resolve <IConsumeOffsetStore>();
 }
Example #34
0
 public QueryProducerInfoRequestHandler()
 {
     _binarySerializer = ObjectContainer.Resolve <IBinarySerializer>();
     _producerManager  = ObjectContainer.Resolve <ProducerManager>();
 }
Example #35
0
 protected override int SerializeExclusiveData(IBinarySerializer serializer, BinaryWriter writer, BinarySerializerSettings settings = null)
 {
     return(serializer.Serialize(Descriptors, writer, settings));
 }
Example #36
0
 public ConsumerHeartbeatRequestHandler(BrokerController brokerController)
 {
     _consumerManager  = ObjectContainer.Resolve <ConsumerManager>();
     _binarySerializer = ObjectContainer.Resolve <IBinarySerializer>();
 }
 public GetTopicAccumulateInfoListRequestHandler(NameServerController nameServerController)
 {
     _clusterManager   = nameServerController.ClusterManager;
     _binarySerializer = ObjectContainer.Resolve <IBinarySerializer>();
 }
Example #38
0
 public DisableQueueRequestHandler()
 {
     _binarySerializer = ObjectContainer.Resolve <IBinarySerializer>();
     _queueService     = ObjectContainer.Resolve <IQueueService>();
 }
Example #39
0
 /// <summary>
 /// Handles the serialization using the specified serializer
 /// </summary>
 /// <param name="s">The serializer</param>
 public void Serialize(IBinarySerializer s)
 {
     Data = s.SerializeArray <byte>(Data, 17, name: nameof(Data));
 }
Example #40
0
 /// <summary>
 /// Deserialize logic
 /// </summary>
 /// <param name="deserializer">Deserializer</param>
 /// <param name="reader">Reader</param>
 /// <param name="settings">Settings</param>
 /// <returns>How many bytes have been written</returns>
 protected virtual void DeserializeExclusiveData(IBinarySerializer deserializer, BinaryReader reader, BinarySerializerSettings settings = null)
 {
 }
Example #41
0
 /// <summary>
 /// Serialize logic
 /// </summary>
 /// <param name="serializer">Serializer</param>
 /// <param name="writer">Writer</param>
 /// <param name="settings">Settings</param>
 /// <returns>How many bytes have been written</returns>
 protected virtual int SerializeExclusiveData(IBinarySerializer serializer, BinaryWriter writer, BinarySerializerSettings settings = null)
 {
     return(0);
 }
Example #42
0
 public SetQueueNextConsumeOffsetForClusterRequestHandler(NameServerController nameServerController)
 {
     _binarySerializer     = ObjectContainer.Resolve <IBinarySerializer>();
     _nameServerController = nameServerController;
 }
 public int Serialize(IBinarySerializer serializer, BinaryWriter writer, object value, BinarySerializerSettings settings = null)
 {
     writer.Write((short)value);
     return(2);
 }
 public object Deserialize(IBinarySerializer deserializer, BinaryReader reader, Type type, BinarySerializerSettings settings = null)
 {
     return(reader.ReadInt16());
 }
Example #45
0
 public History(IBinarySerializer serializer)
 {
     this._serializer = serializer;
 }
Example #46
0
 public GetConsumerListRequestHandler()
 {
     _binarySerializer       = ObjectContainer.Resolve <IBinarySerializer>();
     _getConsumerListService = ObjectContainer.Resolve <GetConsumerListService>();
 }
Example #47
0
 /// <summary>
 /// Parameterized constructor.
 /// </summary>
 public DefaultMemoryCache(IBinarySerializer serializer)
 {
     this._serializer = serializer;
     this._enabled    = ConfigurationManager.AppSettings["thinkcfg.caching_enabled"].Safe("false").ToBoolean();
 }
 private int SetUInt32Value(IBinarySerializer serializer, BinaryWriter writer, object value)
 {
     writer.Write((uint)value);
     return(4);
 }
Example #49
0
 //Use BinaryInitializer to inject IBinarySerializer
 public static void Initialize(IBinarySerializer binarySerializer)
 {
     Default = binarySerializer;
 }
 private int SetUInt64Value(IBinarySerializer serializer, BinaryWriter writer, object value)
 {
     writer.Write((ulong)value);
     return(8);
 }
Example #51
0
 public GetMessageDetailRequestHandler()
 {
     _messageStore     = ObjectContainer.Resolve <IMessageStore>();
     _binarySerializer = ObjectContainer.Resolve <IBinarySerializer>();
 }
Example #52
0
 public RedisMemoryCache(string host, int port)
 {
     _redisClient      = new RedisClient(host, port);
     _binarySerializer = ObjectContainer.Resolve <IBinarySerializer>();
 }
Example #53
0
 public void Serialize(IBinarySerializer serializer)
 {
     serializer.Write(ExecutorId);
     serializer.Write(ExecutorApiKey);
 }
Example #54
0
 public DeleteTopicRequestHandler()
 {
     _binarySerializer = ObjectContainer.Resolve <IBinarySerializer>();
     _queueStore       = ObjectContainer.Resolve <IQueueStore>();
 }
 public int SetRecursiveValue(IBinarySerializer serializer, BinaryWriter writer, object value)
 {
     return(serializer.Serialize(value, writer));
 }
 public SetQueueProducerVisibleRequestHandler()
 {
     _binarySerializer = ObjectContainer.Resolve <IBinarySerializer>();
     _queueStore       = ObjectContainer.Resolve <IQueueStore>();
 }
 public DeleteQueueForClusterRequestHandler(NameServerController nameServerController)
 {
     _binarySerializer     = ObjectContainer.Resolve <IBinarySerializer>();
     _nameServerController = nameServerController;
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="binarySerializer"></param>
 /// <param name="encoding">对value为string类型的直接使用Encoding.GetBytes</param>
 public BinaryCompressProtocol(IBinarySerializer binarySerializer, Encoding encoding)
 {
     this.binarySerializer = binarySerializer;
     this.Encoding         = encoding;
 }
 private int SetDoubleValue(IBinarySerializer serializer, BinaryWriter writer, object value)
 {
     writer.Write((double)value);
     return(8);
 }
 private int SetSByteValue(IBinarySerializer serializer, BinaryWriter writer, object value)
 {
     writer.Write((sbyte)value);
     return(1);
 }