public async Task <IQueueAdapter> CreateAdapter()
        {
            // In AzureQueueAdapterFactory an adapter is made per call, so we do the same
            IQueueAdapter adapter;

            if (_useRedisForQueue)
            {
                //adapter = new PhysicalQueues.Redis.RedisQueueAdapter(_logger, GetStreamQueueMapper(), _providerName, _server, _databaseNum);
                var redisQueueProvider = new PhysicalQueues.Redis.RedisQueueProvider();
                var redisAdapter       = new PhysicalQueues.GenericQueueAdapter(_logger, GetStreamQueueMapper(), _providerName, _config, redisQueueProvider, _numQueues);
                await redisAdapter.Init();

                adapter = redisAdapter;
            }
            else
            {
                var memoryQueueProvider = new PhysicalQueues.Memory.MemoryQueueProvider();
                adapter = new PhysicalQueues.GenericQueueAdapter(_logger, GetStreamQueueMapper(), _providerName, _config, memoryQueueProvider, _numQueues);
            }

            return(adapter);
        }
コード例 #2
0
        public async Task<IQueueAdapter> CreateAdapter()
        {
            // In AzureQueueAdapterFactory an adapter is made per call, so we do the same
            IQueueAdapter adapter;
            if (_useRedisForQueue)
            {
                //adapter = new PhysicalQueues.Redis.RedisQueueAdapter(_logger, GetStreamQueueMapper(), _providerName, _server, _databaseNum);
                var redisQueueProvider = new PhysicalQueues.Redis.RedisQueueProvider();
                var redisAdapter = new PhysicalQueues.GenericQueueAdapter(_logger, GetStreamQueueMapper(), _providerName, _config, redisQueueProvider, _numQueues);
                await redisAdapter.Init();
                adapter = redisAdapter;
            }
            else
            {
                var memoryQueueProvider = new PhysicalQueues.Memory.MemoryQueueProvider();
                var memoryAdapter = new PhysicalQueues.GenericQueueAdapter(_logger, GetStreamQueueMapper(), _providerName, _config, memoryQueueProvider, _numQueues);
                await memoryAdapter.Init();
                adapter = memoryAdapter;
            }

            return adapter;
        }