addProducer() private method

private addProducer ( ProducerId id, MessageProducer producer ) : void
id Apache.NMS.ActiveMQ.Commands.ProducerId
producer MessageProducer
return void
Esempio n. 1
0
        public IMessageProducer CreateProducer(IDestination destination)
        {
            ProducerInfo    command    = CreateProducerInfo(destination);
            ProducerId      producerId = command.ProducerId;
            MessageProducer producer   = null;

            try
            {
                producer = new MessageProducer(this, command);
                producers[producerId] = producer;
                this.connection.Oneway(command);
            }
            catch (Exception)
            {
                if (producer != null)
                {
                    producer.Close();
                }

                throw;
            }

            // Registered with Connection so it can process Producer Acks.
            connection.addProducer(producerId, producer);

            return(producer);
        }