Beispiel #1
0
        public void Initialize()
        {
            const string suffix = "_dead_letter";

            Consumer = MessageConsumerFactory.Create(
                new ExchangeDeclareConfiguration(
                    AbpRabbitMqEventBusOptions.ExchangeName,
                    type: "direct",
                    durable: true,
                    deadLetterExchangeName: AbpRabbitMqEventBusOptions.ExchangeName + suffix
                    ),
                new QueueDeclareConfiguration(
                    AbpRabbitMqEventBusOptions.ClientName,
                    durable: true,
                    exclusive: false,
                    autoDelete: false,
                    AbpEventBusOptions.DeadLetterName ?? AbpRabbitMqEventBusOptions.ClientName + suffix
                    ),
                AbpRabbitMqEventBusOptions.ConnectionName
                );

            Consumer.OnMessageReceived(ProcessEventAsync);

            SubscribeHandlers(AbpDistributedEventBusOptions.Handlers);
        }
        public void Initialize()
        {
            Consumer = MessageConsumerFactory.Create(
                new ExchangeDeclareConfiguration(
                    RabbitMqEventBusOptions.ExchangeName,
                    type: "topic",
                    durable: true
                    ),
                new QueueDeclareConfiguration(
                    RabbitMqEventBusOptions.ClientName,
                    durable: true,
                    exclusive: false,
                    autoDelete: false
                    ),
                RabbitMqEventBusOptions.ConnectionName
                );

            Consumer.OnMessageReceived(ProcessEventAsync);
        }
Beispiel #3
0
    public void Initialize()
    {
        Consumer = MessageConsumerFactory.Create(
            new ExchangeDeclareConfiguration(
                AbpRabbitMqEventBusOptions.ExchangeName,
                type: AbpRabbitMqEventBusOptions.GetExchangeTypeOrDefault(),
                durable: true
                ),
            new QueueDeclareConfiguration(
                AbpRabbitMqEventBusOptions.ClientName,
                durable: true,
                exclusive: false,
                autoDelete: false
                ),
            AbpRabbitMqEventBusOptions.ConnectionName
            );

        Consumer.OnMessageReceived(ProcessEventAsync);

        SubscribeHandlers(AbpDistributedEventBusOptions.Handlers);
    }
        public RabbitMqDistributedEventBus(
            IOptions <RabbitMqEventBusOptions> options,
            IConnectionPool connectionPool,
            IRabbitMqSerializer serializer,
            IHybridServiceScopeFactory serviceScopeFactory,
            IOptions <DistributedEventBusOptions> distributedEventBusOptions,
            IRabbitMqMessageConsumerFactory messageConsumerFactory)
            : base(serviceScopeFactory)
        {
            ConnectionPool             = connectionPool;
            Serializer                 = serializer;
            MessageConsumerFactory     = messageConsumerFactory;
            DistributedEventBusOptions = distributedEventBusOptions.Value;
            RabbitMqEventBusOptions    = options.Value;

            HandlerFactories = new ConcurrentDictionary <Type, List <IEventHandlerFactory> >();
            EventTypes       = new ConcurrentDictionary <string, Type>();

            Consumer = MessageConsumerFactory.Create(
                new ExchangeDeclareConfiguration(
                    RabbitMqEventBusOptions.ExchangeName,
                    type: "direct",
                    durable: true
                    ),
                new QueueDeclareConfiguration(
                    RabbitMqEventBusOptions.ClientName,
                    durable: true,
                    exclusive: false,
                    autoDelete: false
                    ),
                RabbitMqEventBusOptions.ConnectionName
                );

            Consumer.OnMessageReceived(ProcessEventAsync);

            SubscribeHandlers(DistributedEventBusOptions.Handlers);
        }