示例#1
0
        public Task AddGrainConsumer <PrimaryKey>()
        {
            var observerUnits = observerUnitContainer.GetUnits <PrimaryKey>(EventName);

            foreach (var observerUnit in observerUnits)
            {
                string queueNameSuffix = observerUnit.EventHandlerType.FullName;
                var    consumer        = new RabbitConsumer(
                    observerUnit.GetEventHandler())
                {
                    EventBus  = this,
                    QueueInfo = new QueueInfo {
                        RoutingKey = string.Empty, Queue = $"{RoutePrefix}_{queueNameSuffix}"
                    },
                    Config = ConsumerConfig
                };
                Consumers.Add(consumer);
            }
            return(Enable());
        }