Beispiel #1
0
        /// <summary>
        /// 注册一个指定了Host的特定routerKey的拉消费者
        /// </summary>
        /// <param name="routerKey">注册接受特定的routerKey的消息</param>
        /// <param name="queueName">将特定的routerKey的消息接受到自己的queueName中</param>
        /// <param name="host">特定的host服务器</param>
        /// <param name="autoDelete">是否自动删除autoDelete,一般不要在注册的时候设置为true,在处理完消息的回调中删除消息</param>
        public static PullConsumer <MQProtocol <M> > PullConsumeRegister(string routerKey, string queueName, VirtualHost host, bool autoDelete)
        {
            PullConsumer <MQProtocol <M> > c = new PullConsumer <MQProtocol <M> >(ExchangeConst.DefaultExchange, routerKey, queueName, autoDelete, host);

            consumers.Add(c);
            c.Register();
            return(c);
        }
Beispiel #2
0
        public virtual PullConsumer createPullConsumer(ONSFactoryProperty factoryProperty)
        {
            global::System.IntPtr cPtr = ONSClient4CPPPINVOKE.ONSFactoryAPI_createPullConsumer(swigCPtr, ONSFactoryProperty.getCPtr(factoryProperty));
            PullConsumer          ret  = (cPtr == global::System.IntPtr.Zero) ? null : new PullConsumer(cPtr, false);

            if (ONSClient4CPPPINVOKE.SWIGPendingException.Pending)
            {
                throw ONSClient4CPPPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Beispiel #3
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PullConsumer obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Beispiel #4
0
 public override void Start()
 {
     consumer = ONSFactory.getInstance().createPullConsumer(this.FactoryProperty);
     consumer.start();
 }