/// <summary>
        /// 创建消息队列连接并打开
        /// </summary>
        /// <param name="factory">Rabbit连接工厂</param>
        /// <param name="funQueueReader">消息队列读取</param>
        /// <param name="options">配置</param>
        /// <returns>消息队列连接</returns>
        public static IMessageQueueConnection CreateConnectionAndOpen(this IMessageQueueConnectionFactory factory, Func <string, IRabbitMessageQueueReader> funQueueReader = null, Action <RabbitConnectionWrapInfo> options = null)
        {
            if (factory == null)
            {
                throw new ArgumentNullException("Rabbit连接工厂不能为null");
            }
            var config = new RabbitConnectionWrapInfo();

            if (options != null)
            {
                options(config);
            }

            var conn = factory.CreateAndOpen(config);
            IRabbitMessageQueueReader ququeReader = null;

            if (funQueueReader == null)
            {
                ququeReader = new RabbitMessageQueueJson(config.MessageQueueJsonFile);
            }
            else
            {
                ququeReader = funQueueReader(config.MessageQueueJsonFile);
            }
            conn.SetMessageQueueReader(ququeReader);

            return(conn);
        }
Example #2
0
 /// <summary>
 /// 创建消息队列连接来自微软配置并打开
 /// </summary>
 /// <param name="factory">Rabbit连接工厂</param>
 /// <param name="funQueueReader">消息队列读取</param>
 /// <param name="options">配置</param>
 /// <param name="beforeConfigBuilder">生成配置前回调</param>
 /// <returns>消息队列连接</returns>
 public static IMessageQueueConnection CreateConnectionConfigureAndOpen(this IMessageQueueConnectionFactory factory, Func <string, IRabbitMessageQueueReader> funQueueReader = null, Action <RabbitConnectionWrapInfo> options = null, Action <IConfigurationBuilder, string, object> beforeConfigBuilder = null)
 {
     return(factory.CreateConnectionAndOpen(jsonFile =>
     {
         return new RabbitMessageQueueConfiguration(jsonFile, beforeConfigBuilder);
     }, options));
 }
 public SMessageTypeListenerStore(IMessageQueueConnectionFactory messageQueueConnectionFactory)
 {
     _messageQueueConnectionFactory = messageQueueConnectionFactory;
 }
Example #4
0
 public WeatherForecastController(ILogger <WeatherForecastController> logger, IMessageQueueConnection conn, IMessageQueueConnectionFactory factory)
 {
     _logger      = logger;
     this.conn    = conn;
     this.factory = factory;
 }
Example #5
0
        /// <summary>
        /// 创建消息队列连接来自微软配置并打开
        /// </summary>
        /// <param name="factory">Rabbit连接工厂</param>
        /// <param name="funQueueReader">消息队列读取</param>
        /// <param name="options">配置</param>
        /// <param name="beforeConfigBuilder">生成配置前回调</param>
        /// <returns>消息队列连接</returns>
        public static IMessageQueueConnection CreateConnectionConfigureAndOpen(out IMessageQueueConnectionFactory factory, Func <string, IRabbitMessageQueueReader> funQueueReader = null, Action <RabbitConnectionWrapInfo> options = null, Action <IConfigurationBuilder, string, object> beforeConfigBuilder = null)
        {
            factory = new RabbitConnectionFactory();

            return(CreateConnectionConfigureAndOpen(factory, funQueueReader, options, beforeConfigBuilder));
        }
Example #6
0
 public SQueueProcessGroupStore(IMessageQueueConnectionFactory messageQueueConnectionFactory)
 {
     _messageQueueConnectionFactory = messageQueueConnectionFactory;
 }
 public ClientSMessageTypeListenerEndpointStore(IMessageQueueConnectionFactory messageQueueConnectionFactory)
 {
     _messageQueueConnectionFactory = messageQueueConnectionFactory;
 }
        /// <summary>
        /// 创建消息队列连接并打开
        /// </summary>
        /// <param name="factory">Rabbit连接工厂</param>
        /// <param name="funQueueReader">消息队列读取</param>
        /// <param name="options">配置</param>
        /// <returns>消息队列连接</returns>
        public static IMessageQueueConnection CreateConnectionAndOpen(out IMessageQueueConnectionFactory factory, Func <string, IRabbitMessageQueueReader> funQueueReader = null, Action <RabbitConnectionWrapInfo> options = null)
        {
            factory = new RabbitConnectionFactory();

            return(CreateConnectionAndOpen(factory, funQueueReader, options));
        }
 public SMessageHistoryListenerDetailStore(IHashGroupRepositoryCacheProxy hashGroupRepository, IMessageQueueConnectionFactory messageQueueConnectionFactory, IStoreInfoResolveService storeInfoResolveService)
 {
     _hashGroupRepository           = hashGroupRepository;
     _messageQueueConnectionFactory = messageQueueConnectionFactory;
     _storeInfoResolveService       = storeInfoResolveService;
 }
Example #10
0
 public SMessageStoreForSQLDB(IMessageQueueConnectionFactory messageQueueConnectionFactory)
 {
     _messageQueueConnectionFactory = messageQueueConnectionFactory;
 }
Example #11
0
 public SMessageExecuteTypeStore(IMessageQueueConnectionFactory messageQueueConnectionFactory)
 {
     _messageQueueConnectionFactory = messageQueueConnectionFactory;
 }
Example #12
0
 public SQueueStore(IMessageQueueConnectionFactory messageQueueConnectionFactory)
 {
     _messageQueueConnectionFactory = messageQueueConnectionFactory;
 }
Example #13
0
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="connectionFactoy">消息队列连接工厂</param>
 /// <param name="rabbitConfigReader">Rabbit配置读取</param>
 public RabbitRpcClientMethod(IMessageQueueConnectionFactory connectionFactoy, IRabbitConfigReader rabbitConfigReader)
 {
     this.connectionFactoy   = connectionFactoy;
     this.rabbitConfigReader = rabbitConfigReader;
 }