Apache.NMS.ActiveMQ.MessageProducer.Close C# (CSharp) Method

Close() public method

public Close ( ) : void
return void
        public void Close()
        {
            lock(closedLock)
            {
                if(closed)
                {
                    return;
                }

                Shutdown();
                RemoveInfo removeInfo = new RemoveInfo();
                removeInfo.ObjectId = this.info.ProducerId;
                this.session.Connection.Oneway(removeInfo);
                if(Tracer.IsDebugEnabled)
                {
                    Tracer.DebugFormat("Remove of Producer[{0}] sent.", this.ProducerId);
                }
            }
        }

Usage Example

Exemplo n.º 1
0
        public IMessageProducer CreateProducer(IDestination destination)
        {
            MessageProducer producer = null;

            try
            {
                ActiveMQDestination dest = null;
                if (destination != null)
                {
                    dest = ActiveMQDestination.Transform(destination);
                }

                producer = DoCreateMessageProducer(GetNextProducerId(), dest);

                producer.ProducerTransformer = this.ProducerTransformer;

                this.AddProducer(producer);
                this.Connection.Oneway(producer.ProducerInfo);
            }
            catch (Exception)
            {
                if (producer != null)
                {
                    this.RemoveProducer(producer.ProducerId);
                    producer.Close();
                }

                throw;
            }

            return(producer);
        }
All Usage Examples Of Apache.NMS.ActiveMQ.MessageProducer::Close