public MessageConsumer(Session session, int consumerId, Destination dest, AcknowledgementMode acknowledgementMode)
 {
     this.session = session;
     this.id = consumerId;
     this.destination = dest;
     this.acknowledgementMode = acknowledgementMode;
 }
        public void Start()
        {
            // Don't try creating receiver if session not yet up
            if (!session.IsStarted)
            {
                throw new SessionClosedException();
            }

            if (started.CompareAndSet(false, true))
            {
                try
                {
                    // Create qpid receiver
                    Tracer.DebugFormat("Start Consumer Id = " + ConsumerId.ToString());
                    if (qpidReceiver == null)
                    {
                        qpidReceiver = session.CreateQpidReceiver(destination.Address);
                        // Recover replyTo address from qpid receiver and set as the
                        // replyTo destination for received messages.
                        Address replyTo = qpidReceiver.GetAddress();
                        if (destination.IsQueue)
                        {
                            Queue queue = new Queue(replyTo.Name, replyTo.Subject, replyTo.Options);
                            replyToDestination = (Destination)queue;
                        }
                        else if (destination.IsTopic)
                        {
                            Topic topic = new Topic(replyTo.Name, replyTo.Subject, replyTo.Options);
                            replyToDestination = (Destination)topic;
                        }
                    }
                }
                catch (Org.Apache.Qpid.Messaging.QpidException e)
                {
                    throw new NMSException("Failed to create Qpid Receiver : " + e.Message);
                }
            }
        }
Beispiel #3
0
 protected Destination(Destination other)
 {
     qpidAddress = new Org.Apache.Qpid.Messaging.Address(other.Address);
 }
Beispiel #4
0
 internal virtual MessageConsumer DoCreateMessageConsumer(int id, Destination destination, AcknowledgementMode mode)
 {
     return(new MessageConsumer(this, id, destination, mode));
 }
 public MessageProducer(Session session, int producerId, Destination destination)
 {
     this.session = session;
     this.id = producerId;
     this.destination = destination;
 }
Beispiel #6
0
 internal virtual MessageProducer DoCreateMessageProducer(Destination destination)
 {
     return(new MessageProducer(this, GetNextProducerId(), destination));
 }
Beispiel #7
0
 public MessageProducer(Session session, int producerId, Destination destination)
 {
     this.session     = session;
     this.id          = producerId;
     this.destination = destination;
 }
Beispiel #8
0
 protected Destination(Destination other)
 {
     qpidAddress = new Org.Apache.Qpid.Messaging.Address(other.Address);
 }
Beispiel #9
0
 internal virtual MessageConsumer DoCreateMessageConsumer(int id, Destination destination, AcknowledgementMode mode)
 {
     return new MessageConsumer(this, id, destination, mode);
 }
Beispiel #10
0
 internal virtual MessageProducer DoCreateMessageProducer(Destination destination)
 {
     return new MessageProducer(this, GetNextProducerId(), destination);
 }