public DefaultConsumingProcess(IIdGenerator idGenerator, IExchangeResolver exchangeResolver, IMessageSerializer serializer, IMessageTypeResolver messageTypeResolver, IConsumerContainer consumerContainer, IMessageFilter messageFilters, IQueueFactory queueFactory, IConsumerInvoker consumerInvoker, RogerOptions options, IAggregator aggregator) { this.consumerContainer = consumerContainer; this.queueFactory = queueFactory; this.consumerInvoker = consumerInvoker; this.options = options; this.aggregator = aggregator; this.exchangeResolver = exchangeResolver; bindingKeyResolver = new DefaultRoutingKeyResolver(); this.messageTypeResolver = messageTypeResolver; this.serializer = serializer; this.idGenerator = idGenerator; supportedMessageTypesResolver = new DefaultSupportedMessageTypesResolver(); this.messageFilters = messageFilters; aggregator.Subscribe(this); }
public static void Init(IProducerContainer _producerContainer, IConsumerContainer _consumerContainer, ILogger logger = null) { producerContainer = _producerContainer; consumerContainer = _consumerContainer; if (logger != null) { MessagingAccessPointFactory.getMessagingAccessPoint().addLogger(logger); } }
public static void Init(IMonitor _monitor, ILogger logger = null) { producerContainer = new RabbitMQProducerContainer(); consumerContainer = new RabbitMQConsumerContainer(_monitor); if (logger != null) { MessagingAccessPointFactory.getMessagingAccessPoint().addLogger(logger); } }
/// <summary> /// Default library entry point /// </summary> /// <param name="connectionFactory"></param> /// <param name="consumerContainer"></param> /// <param name="exchangeResolver"></param> /// <param name="serializer"></param> /// <param name="idGenerator"></param> /// <param name="sequenceGenerator"></param> /// <param name="options"> </param> public RogerBus(IConnectionFactory connectionFactory, IConsumerContainer consumerContainer = null, IExchangeResolver exchangeResolver = null, IMessageSerializer serializer = null, IIdGenerator idGenerator = null, ISequenceGenerator sequenceGenerator = null, RogerOptions options = null) { aggregator = new Aggregator(); reconnectionTimer = new SystemThreadingTimer(); connection = new ReliableConnection(connectionFactory, reconnectionTimer, aggregator); consumerContainer = consumerContainer.Or(new EmptyConsumerContainer()); exchangeResolver = exchangeResolver.Or(new AttributeExchangeResolver()); serializer = serializer.Or(new ProtoBufNetSerializer()); idGenerator = idGenerator.Or(new RandomIdGenerator()); sequenceGenerator = sequenceGenerator.Or(new ByMessageHirarchyRootSequenceGenerator()); options = options.Or(new RogerOptions()); publishModules.Add(new BasicReturnModule()); if (options.UsePublisherConfirms) { publishModules.AddFirst(new PublisherConfirmsModule(TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10))); } var queueFactory = new DefaultQueueFactory(true, false, false, options.QueueUnusedTimeout, options.MessageTimeToLiveOnQueue, options.QueueName); Filters.Add(new ResequencingDeduplicationFilter()); consumer = new DefaultConsumingProcess(idGenerator, exchangeResolver, serializer, new DefaultMessageTypeResolver(), consumerContainer, Filters, queueFactory, new AlwaysSuccessConsumerInvoker(), options, aggregator); publisher = new QueueingPublishingProcess(idGenerator, sequenceGenerator, exchangeResolver, serializer, new DefaultMessageTypeResolver(), publishModules, aggregator); aggregator.Subscribe(this); }
public async Task ValidateAsync(IConsumerContainer consumerContainer) { if (consumerContainer == null) { throw new ArgumentNullException(nameof(consumerContainer)); } if (consumerContainer.ConsumerId.HasValue) { var department = await this.ConsumerDAL.GetAsync(new ConsumerIdentityModel(consumerContainer.ConsumerId.Value)); if (department == null) { throw new InvalidOperationException($"Department not found by id {consumerContainer.ConsumerId}"); } } }
public ConsumerHandler(IConsumerContainer container, IConfiguration config) { _shutdown = new ManualResetEvent(false); _container = container; _config = config; }
public void SetContainer(IConsumerContainer container) { Container = container; }