public static AbsQueue GetQueueClient(QueueConfig config, EventDeclare eventDeclare) { var _queueName = config.QueueName; var key = $"CRL_{_queueName}_{eventDeclare.IsAsync}"; var a = clients.TryGetValue(key, out AbsQueue client); if (!a) { client = CreateClient(config, eventDeclare.IsAsync); clients.TryAdd(key, client); } return(client); }
public static AbsQueue CreateClient(QueueConfig config, bool async) { AbsQueue instance = null; switch (config.MQType) { case MQType.RabbitMQ: instance = new Queue.RabbitMQ(config, async); break; case MQType.Redis: instance = new Queue.Redis(config); break; case MQType.MongoDb: instance = new Queue.MongoDb(config); break; } return(instance); }
public SubscribeService(QueueConfig _queueConfig) { queueConfig = _queueConfig; }
public Publisher(QueueConfig _queueConfig) { queue = QueueFactory.CreateClient(_queueConfig, false); }
public SubscribeService(Microsoft.Extensions.Options.IOptions <QueueConfig> options) { queueConfig = options.Value; }