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