public void Dispatch(MessageDispatch dispatch) { try { MessageConsumer consumer = null; lock (this.consumers.SyncRoot) { // if(this.consumers.Contains(dispatch.ConsumerId)) // { // consumer = this.consumers[dispatch.ConsumerId] as MessageConsumer; // } } // If the consumer is not available, just ignore the message. // Otherwise, dispatch the message to the consumer. if (consumer != null) { consumer.Dispatch(dispatch); } } catch (Exception ex) { Tracer.DebugFormat("Caught Exception While Dispatching: {0}", ex.Message); } }
public void RemoveConsumer(MessageConsumer consumer) { //connection.RemoveDispatcher(consumer.ConsumerId); if (!this.closing) { consumers.Remove(consumer.ConsumerId); } connection.RemoveDispatcher(consumer); }
public void AddConsumer(MessageConsumer consumer) { if (!this.closing) { int id = consumer.ConsumerId; // Registered with Connection before we register at the broker. consumers[id] = consumer; //connection.AddDispatcher(id, this); } }
public IMessageConsumer CreateDurableConsumer(ITopic destination, string name, string selector, bool noLocal) { if (destination == null) { throw new InvalidDestinationException("Cannot create a Consumer with a Null destination"); } MessageConsumer consumer = null; return(consumer); }