Inheritance: BaseDataStructure
Exemplo n.º 1
0
        public MessageProducer(Session session, ProducerId id, ActiveMQDestination destination, TimeSpan requestTimeout)
        {
            this.session = session;
            this.RequestTimeout = requestTimeout;

            this.info = new ProducerInfo();
            this.info.ProducerId = id;
            this.info.Destination = destination;
            this.info.WindowSize = session.Connection.ProducerWindowSize;

            this.messageTransformation = session.Connection.MessageTransformation;

            // If the destination contained a URI query, then use it to set public
            // properties on the ProducerInfo
            if(destination != null && destination.Options != null)
            {
                URISupport.SetProperties(this.info, destination.Options, "producer.");
            }

            // Version Three and higher will send us a ProducerAck, but only if we
            // have a set producer window size.
            if(session.Connection.ProtocolVersion >= 3 && this.info.WindowSize > 0)
            {
                Tracer.Debug("MessageProducer created with a Window Size of: " + this.info.WindowSize);
                this.usage = new MemoryUsage(this.info.WindowSize);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sets the value as a String
        /// </summary>
        public void SetValue(string messageKey)
        {
            this.key = messageKey;

            // Parse off the sequenceId
            int p = messageKey.LastIndexOf(":");

            if (p >= 0)
            {
                producerSequenceId = Int64.Parse(messageKey.Substring(p + 1));
                messageKey         = messageKey.Substring(0, p);
            }
            producerId = new ProducerId(messageKey);
        }
Exemplo n.º 3
0
 public virtual bool Equals(ProducerId that)
 {
     if (!Equals(this.ConnectionId, that.ConnectionId))
     {
         return(false);
     }
     if (!Equals(this.Value, that.Value))
     {
         return(false);
     }
     if (!Equals(this.SessionId, that.SessionId))
     {
         return(false);
     }
     return(true);
 }
Exemplo n.º 4
0
 public SessionId(ProducerId producerId)
 {
     this.ConnectionId = producerId.ConnectionId;
     this.value        = producerId.SessionId;
 }
Exemplo n.º 5
0
 public MessageId(ProducerId producerId, long producerSequenceId)
     : base()
 {
     this.producerId = producerId;
     this.producerSequenceId = producerSequenceId;
 }
Exemplo n.º 6
0
        /// <summary>
        /// Sets the value as a String
        /// </summary>
        public void SetValue(string messageKey)
        {
            this.key = messageKey;

            // Parse off the sequenceId
            int p = messageKey.LastIndexOf(":");
            if(p >= 0)
            {
                producerSequenceId = Int64.Parse(messageKey.Substring(p + 1));
                messageKey = messageKey.Substring(0, p);
            }
            producerId = new ProducerId(messageKey);
        }
Exemplo n.º 7
0
        public virtual bool Equals(ProducerId that)
        {
            if(!Equals(this.ConnectionId, that.ConnectionId))
            {
                return false;
            }
            if(!Equals(this.Value, that.Value))
            {
                return false;
            }
            if(!Equals(this.SessionId, that.SessionId))
            {
                return false;
            }

            return true;
        }
Exemplo n.º 8
0
		public ProducerState getProducerState(ProducerId producerId)
		{
			return producers[producerId];
		}
Exemplo n.º 9
0
		public ProducerState removeProducer(ProducerId id)
		{
			ProducerState ret = producers[id];
			producers.Remove(id);
			return ret;
		}
Exemplo n.º 10
0
        public ProducerId GetNextProducerId()
        {
            ProducerId id = new ProducerId();
            id.ConnectionId = info.SessionId.ConnectionId;
            id.SessionId = info.SessionId.Value;
            id.Value = Interlocked.Increment(ref producerCounter);

            return id;
        }
Exemplo n.º 11
0
 public MessageId(ProducerId producerId, long producerSequenceId) : base()
 {
     this.producerId         = producerId;
     this.producerSequenceId = producerSequenceId;
 }
Exemplo n.º 12
0
 public virtual Response processRemoveProducer(ProducerId id)
 {
     return null;
 }
Exemplo n.º 13
0
 public override Response processRemoveProducer(ProducerId id)
 {
     if(id != null)
     {
         SessionId sessionId = id.ParentId;
         if(sessionId != null)
         {
             ConnectionId connectionId = sessionId.ParentId;
             if(connectionId != null)
             {
                 ConnectionState cs = connectionStates[connectionId];
                 if(cs != null)
                 {
                     SessionState ss = cs[sessionId];
                     if(ss != null)
                     {
                         ss.removeProducer(id);
                     }
                 }
             }
         }
     }
     return TRACKED_RESPONSE_MARKER;
 }
Exemplo n.º 14
0
 public ConnectionId(ProducerId producerId)
 {
     this.value = producerId.ConnectionId;
 }
Exemplo n.º 15
0
 public ProducerAck(ProducerId producerId, int size)
 {
     this.myProducerId = producerId;
     this.mySize       = size;
 }
Exemplo n.º 16
0
 /// <summary>
 /// Converts the object to a String
 /// </summary>
 public static string ToString(ProducerId id)
 {
     return id.ConnectionId + ":" + id.SessionId + ":" + id.Value;
 }
Exemplo n.º 17
0
 internal void addProducer( ProducerId id, MessageProducer producer )
 {
     if(!this.closing.Value)
     {
         this.producers.Add( id, producer );
     }
 }
Exemplo n.º 18
0
		public ProducerState this[ProducerId producerId]
		{
			get
			{
				return producers[producerId];
			}
		}
Exemplo n.º 19
0
 internal void removeProducer( ProducerId id )
 {
     if(!this.closing.Value)
     {
         this.producers.Remove( id );
     }
 }
Exemplo n.º 20
0
 public void RemoveProducer(ProducerId objectId)
 {
     connection.removeProducer(objectId);
     if(!this.closing)
     {
         producers.Remove(objectId);
     }
 }