public void RemoveConsumer(MessageConsumer consumer) { if (!this.closing) { consumers.Remove(consumer.ConsumerId); } }
public void AddConsumer(MessageConsumer consumer) { if (!this.closing) { // Registered with Connection before we register at the broker. consumers[consumer.ConsumerId] = consumer; } }
public IMessageConsumer CreateConsumer(IDestination destination, string selector, bool noLocal) { if (destination == null) { throw new InvalidDestinationException("Cannot create a Consumer with a Null destination"); } MessageConsumer consumer = null; try { Queue queue = new Queue(destination.ToString()); consumer = DoCreateMessageConsumer(GetNextConsumerId(), queue, acknowledgementMode); consumer.ConsumerTransformer = this.ConsumerTransformer; this.AddConsumer(consumer); if (this.Connection.IsStarted) { consumer.Start(); } } catch (Exception) { if (consumer != null) { this.RemoveConsumer(consumer); consumer.Close(); } throw; } return(consumer); }