public QueueingBasicConsumerWithManagedConnection(IConnectionFactory connectionFactory, ISubscriberCollection <T> subscriberCollection, BoundedContext boundedContext)
 {
     this.connectionFactory    = connectionFactory;
     this.subscriberCollection = subscriberCollection;
     this.boundedContext       = boundedContext;
     queueName = $"{boundedContext}.{typeof(T).Name}";
 }
예제 #2
0
        public ContinuousConsumer(ISubscriberCollection <T> subscriberCollection)
        {
            if (subscriberCollection is null)
            {
                throw new ArgumentNullException(nameof(subscriberCollection));
            }

            this.subscriberCollection = subscriberCollection;
        }
예제 #3
0
 public SynchronousMessageProcessor(
     ISubscriberCollection <IApplicationService> appServiceSubscribers,
     ISubscriberCollection <IProjection> projectionSubscribers,
     ISubscriberCollection <IPort> portSubscribers,
     ISubscriberCollection <IGateway> gatewaySubscribers,
     ISubscriberCollection <ISaga> sagaSubscribers)
     : base(new DefaultTenantResolver())
 {
     this.appServiceSubscribers = appServiceSubscribers;
     this.projectionSubscribers = projectionSubscribers;
     this.portSubscribers       = portSubscribers;
     this.gatewaySubscribers    = gatewaySubscribers;
     this.sagaSubscribers       = sagaSubscribers;
 }
예제 #4
0
 void NotifySubscribers <TContract>(CronusMessage message, ISubscriberCollection <TContract> subscribers)
 {
     try
     {
         var interestedSubscribers = subscribers.GetInterestedSubscribers(message);
         foreach (var subscriber in interestedSubscribers)
         {
             subscriber.Process(message);
         }
     }
     catch (Exception ex)
     {
         log.Error("Unable to process message", ex);
     }
 }
예제 #5
0
 public InMemoryPublisher(
     ISubscriberCollection <IApplicationService> appServiceSubscribers,
     ISubscriberCollection <IProjection> projectionSubscribers,
     ISubscriberCollection <IPort> portSubscribers,
     ISubscriberCollection <IGateway> gatewaySubscribers,
     ISubscriberCollection <ISaga> sagaSubscribers,
     ISubscriberCollection <IEventStoreIndex> esIndexSubscribers,
     IOptionsMonitor <BoundedContext> boundedContext)
     : base(new DefaultTenantResolver(), boundedContext.CurrentValue)
 {
     this.appServiceSubscribers = appServiceSubscribers;
     this.projectionSubscribers = projectionSubscribers;
     this.portSubscribers       = portSubscribers;
     this.gatewaySubscribers    = gatewaySubscribers;
     this.sagaSubscribers       = sagaSubscribers;
     this.esIndexSubscribers    = esIndexSubscribers;
 }
        public RabbitMqConsumer(IConfiguration configuration, BoundedContext boundedContext, ISubscriberCollection <T> subscriberCollection, ISerializer serializer, IConnectionFactory connectionFactory)
        {
            if (ReferenceEquals(null, subscriberCollection))
            {
                throw new ArgumentNullException(nameof(subscriberCollection));
            }
            if (ReferenceEquals(null, serializer))
            {
                throw new ArgumentNullException(nameof(serializer));
            }

            this.boundedContext       = boundedContext;
            numberOfWorkers           = configuration.GetValue <int>("cronus_transport_rabbimq_consumer_workerscount", 5);
            this.subscriberCollection = subscriberCollection;
            this.serializer           = serializer;
            this.connectionFactory    = connectionFactory;
            pools = new List <WorkPool>();
        }
예제 #7
0
파일: Worker.cs 프로젝트: ldematte/TheRing
 public Worker(ITaskConsumer <T> taskQueue, ISubscriberCollection <T> subscribers, IWorkerLogger logger)
 {
     m_taskQueue   = taskQueue;
     m_subscribers = subscribers;
     m_logger      = logger;
 }
 public RabbitMqContinuousConsumer(BoundedContext boundedContext, ISerializer serializer, IConnectionFactory connectionFactory, ISubscriberCollection <T> subscriberCollection)
     : base(subscriberCollection)
 {
     this.deliveryTags = new Dictionary <Guid, ulong>();
     this.serializer   = serializer;
     this.consumer     = new QueueingBasicConsumerWithManagedConnection(connectionFactory, subscriberCollection, boundedContext);
 }