/// <summary> /// Constructor /// </summary> /// <param name="options"></param> /// <param name="mongoDbAdapter"></param> /// <param name="maxQueueSize"></param> /// <param name="exceptionCallback"></param> protected MessageProcessor(MongoDbPopulatorOptions options, IMongoDbAdapter mongoDbAdapter, int maxQueueSize, Action <Exception> exceptionCallback) { Logger = LogManager.GetLogger(GetType().Name); _exceptionCallback = exceptionCallback; MongoDbAdapter = mongoDbAdapter; FailedWriteLimit = options.FailedWriteLimit; MaxQueueSize = maxQueueSize; _processTimer = new SysTimers.Timer(Math.Min(int.MaxValue, ((double)options.MongoDbFlushTime) * 1000)); _processTimer.Elapsed += TimerElapsedEvent; _processTimer.Start(); IsStopping = false; }
public MongoDbPopulatorMessageConsumer(MongoDbOptions mongoDbOptions, MongoDbPopulatorOptions populatorOptions, ConsumerOptions consumerOptions) { if (typeof(T) == typeof(DicomFileMessage)) { var mongoImageAdapter = new MongoDbAdapter("ImageMessageProcessor", mongoDbOptions, populatorOptions.ImageCollection); Processor = (IMessageProcessor <T>) new ImageMessageProcessor(populatorOptions, mongoImageAdapter, consumerOptions.QoSPrefetchCount, ExceptionCallback); } else if (typeof(T) == typeof(SeriesMessage)) { var mongoSeriesAdapter = new MongoDbAdapter("SeriesMessageProcessor", mongoDbOptions, populatorOptions.SeriesCollection); Processor = (IMessageProcessor <T>) new SeriesMessageProcessor(populatorOptions, mongoSeriesAdapter, consumerOptions.QoSPrefetchCount, ExceptionCallback); } else { throw new ArgumentException("Message type " + typeof(T).Name + " not supported here"); } ConsumerOptions = consumerOptions; Logger.Debug(_messageTypePrefix + "Constructed for " + typeof(T).Name); }
public TestMessageProcessor(MongoDbPopulatorOptions options, IMongoDbAdapter mongoDbAdapter, int maxQueueSize, Action <Exception> exceptionCallback) : base(options, mongoDbAdapter, maxQueueSize, exceptionCallback) { }