public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration) { var configuration = enodeConfiguration.GetCommonConfiguration(); configuration.RegisterEQueueComponents(); var consumerSetting = new ConsumerSetting { HeartbeatBrokerInterval = 1000, UpdateTopicQueueCountInterval = 1000, RebalanceInterval = 1000 }; _commandExecutedMessageSender = new CommandExecutedMessageSender(); _eventPublisher = new EventPublisher(); configuration.SetDefault<IEventPublisher, EventPublisher>(_eventPublisher); _commandConsumer = new CommandConsumer(consumerSetting, _commandExecutedMessageSender); _commandConsumer.Subscribe("NoteCommandTopic1"); _commandConsumer.Subscribe("NoteCommandTopic2"); return enodeConfiguration; }
public CommandExecuteContext(IRepository repository, QueueMessage queueMessage, IMessageContext messageContext, CommandMessage commandMessage, CommandExecutedMessageSender commandExecutedMessageSender) { _changedAggregateRootDict = new ConcurrentDictionary <string, IAggregateRoot>(); _repository = repository; _commandExecutedMessageSender = commandExecutedMessageSender; _queueMessage = queueMessage; _commandMessage = commandMessage; _messageContext = messageContext; }
public CommandConsumer( string id = null, string groupName = null, ConsumerSetting setting = null, CommandExecutedMessageSender commandExecutedMessageSender = null) { _consumer = new Consumer(id ?? DefaultCommandConsumerId, groupName ?? DefaultCommandConsumerGroup, setting ?? new ConsumerSetting { MessageHandleMode = MessageHandleMode.Sequential }); _jsonSerializer = ObjectContainer.Resolve <IJsonSerializer>(); _typeCodeProvider = ObjectContainer.Resolve <ITypeCodeProvider>(); _processor = ObjectContainer.Resolve <IMessageProcessor <ProcessingCommand, ICommand, CommandResult> >(); _repository = ObjectContainer.Resolve <IRepository>(); _logger = ObjectContainer.Resolve <ILoggerFactory>().Create(GetType().FullName); _commandExecutedMessageSender = commandExecutedMessageSender ?? new CommandExecutedMessageSender(); }
public static ENodeConfiguration UseEQueue(this ENodeConfiguration enodeConfiguration) { var configuration = enodeConfiguration.GetCommonConfiguration(); configuration.RegisterEQueueComponents(); configuration.SetDefault<ICommandTopicProvider, CommandTopicManager>(); configuration.SetDefault<IEventTopicProvider, EventTopicManager>(); configuration.SetDefault<ICommandTypeCodeProvider, CommandTypeCodeManager>(); var consumerSetting = new ConsumerSetting { HeartbeatBrokerInterval = 1000, UpdateTopicQueueCountInterval = 1000, RebalanceInterval = 1000 }; var eventConsumerSetting = new ConsumerSetting { HeartbeatBrokerInterval = 1000, UpdateTopicQueueCountInterval = 1000, RebalanceInterval = 1000, MessageHandleMode = MessageHandleMode.Sequential }; _broker = new BrokerController().Initialize(); var commandExecutedMessageConsumer = new Consumer(consumerSetting, "CommandExecutedMessageConsumer", "CommandExecutedMessageConsumerGroup_" + ObjectId.GenerateNewId().ToString()); var domainEventHandledMessageConsumer = new Consumer(consumerSetting, "DomainEventHandledMessageConsumer", "DomainEventHandledMessageConsumerGroup_" + ObjectId.GenerateNewId().ToString()); _commandResultProcessor = new CommandResultProcessor(commandExecutedMessageConsumer, domainEventHandledMessageConsumer); _commandService = new CommandService(_commandResultProcessor); _commandExecutedMessageSender = new CommandExecutedMessageSender(); _domainEventHandledMessageSender = new DomainEventHandledMessageSender(); _eventPublisher = new EventPublisher(); configuration.SetDefault<ICommandService, CommandService>(_commandService); configuration.SetDefault<IEventPublisher, EventPublisher>(_eventPublisher); _commandConsumer = new CommandConsumer(consumerSetting, _commandExecutedMessageSender); _eventConsumer = new EventConsumer(eventConsumerSetting, _domainEventHandledMessageSender); _commandConsumer.Subscribe("NoteCommandTopic"); _eventConsumer.Subscribe("NoteEventTopic"); _commandResultProcessor.SetExecutedCommandMessageTopic("ExecutedCommandMessageTopic"); _commandResultProcessor.SetDomainEventHandledMessageTopic("DomainEventHandledMessageTopic"); return enodeConfiguration; }