Ejemplo n.º 1
0
 public MaintenanceBase(INDLoggerFactory loggerFactory)
 {
     if (loggerFactory != null)
     {
         NDLoggerFactoryManger.AddFactory(loggerFactory.GetType().FullName.ToString(), loggerFactory);
         logger = NDLoggerFactoryManger.Instance;
     }
 }
Ejemplo n.º 2
0
        public static void AddFactory(string logCategory, INDLoggerFactory provider)
        {
            if (factorys.ContainsKey(logCategory))
            {
                throw new ArgumentException("添加重复键值:" + logCategory.ToString());
            }
            factorys.Add(logCategory, provider);
            INDLogger logger = provider.CreateLogger();

            if (logger != null)
            {
                loggerCollection.Add(logger);
            }
        }
Ejemplo n.º 3
0
        public RedisMessageBus(INDLoggerFactory logFactory, ISubscriber subscriber, string topic = null) : base(logFactory)

        {
            _subscriber = subscriber;
            _topic      = topic ?? "messages";
        }
Ejemplo n.º 4
0
        public RabbitMQMessageBus(string hostNmae, string userName, string password, string queueName, string routingKey, string exhangeName, bool durable, bool persistent, bool exclusive, bool autoDelete, INDLoggerFactory logFactory, IDictionary <string, object> queueArguments = null, TimeSpan?defaultMessageTimeToLive = null, bool noAck = false)
            : base(logFactory)
        {
            _hostName       = hostNmae;
            _exchangeName   = exhangeName;
            _queueName      = queueName;
            _routingKey     = routingKey;
            _durable        = durable;
            _persistent     = persistent;
            _exclusive      = exclusive;
            _autoDelete     = autoDelete;
            _queueArguments = queueArguments;

            if (defaultMessageTimeToLive.HasValue && defaultMessageTimeToLive.Value > TimeSpan.Zero)
            {
                _defaultMessageTimeToLive = defaultMessageTimeToLive.Value;
            }
            if (noAck != null)
            {
                _noAck = noAck;
            }
            // initialize connection factory
            _factory = new ConnectionFactory
            {
                UserName = userName,
                Password = password,
                HostName = _hostName
            };

            // initialize publisher
            _publisherClient  = CreateConnection();
            _publisherChannel = _publisherClient.CreateModel();
            SetUpExchangeAndQueuesForRouting(_publisherChannel);
            logger.Trace("The unique channel number for the publisher is : {channelNumber}", _publisherChannel.ChannelNumber);

            // initialize subscriber
            _subscriberClient  = CreateConnection();
            _subscriberChannel = _subscriberClient.CreateModel();
            SetUpExchangeAndQueuesForRouting(_subscriberChannel);
            logger.Trace("The unique channel number for the subscriber is : {channelNumber}", _subscriberChannel.ChannelNumber);
        }
Ejemplo n.º 5
0
 public MessageBusBase(INDLoggerFactory logFactory) : base(logFactory)
 {
 }