Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 public SubscribeService(QueueConfig _queueConfig)
 {
     queueConfig = _queueConfig;
 }
Exemple #4
0
 public Publisher(QueueConfig _queueConfig)
 {
     queue = QueueFactory.CreateClient(_queueConfig, false);
 }
Exemple #5
0
 public SubscribeService(Microsoft.Extensions.Options.IOptions <QueueConfig> options)
 {
     queueConfig = options.Value;
 }