public RmqSubscription(string topic, RmqBus bus, IActor <T> actor, ReadQueue queue) { _topic = topic; _bus = bus; _queue = queue; _actor = actor; AttachTo(bus); }
private IModel ProcessChannel(IBus bus, ReadQueue queue) { var channel = _bus.Connections.CreateChannel(queue); var consumer = new EventingBasicConsumer(channel); consumer.Received += (model, ea) => { Notify(bus, ea); }; consumer.Shutdown += (s, e) => { TraceShutDownEvent(e); }; channel.BasicQos(0, queue.PrefetchSize, false); //the argument noAck has been renamed to autoAck from RabbitMq.Client(5.0.1) //for reference https://github.com/rabbitmq/rabbitmq-dotnet-client/issues/255 channel.BasicConsume(queue: queue.Name, autoAck: false, consumer: consumer); return(channel); }
private void ReplaceOldSubscription(string topic, ISubscription subscription, ReadQueue newSettings) { /*create a new connection for same topic with new settings * stop accepting new messages on old channel */ _pool[topic] = new Tuple <ReadQueue, ISubscription>(newSettings, subscription.CreateSubscription(newSettings)); subscription.Stop(); }
public ISubscription CreateSubscription(ReadQueue queue) { return(new RmqSubscription <T>(_topic, _bus, _actor, queue)); }