/// <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); }
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); }
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); }
public override void Start() { consumer = ONSFactory.getInstance().createPullConsumer(this.FactoryProperty); consumer.start(); }