locked
Can a subscriber fall behind? Is it possible to flush its input queue? RRS feed

  • Question

  • I have a publisher publishing data at a high rate, and a subscriber which is not keeping up, and keeps falling behind.  This is determined by the time stamps.  A side effect of this is that the memory usage grows.  Is there a way for the subscriber to flush out the messages in it input queue and get the latest?

     

    Thanks,

    Paul

    Wednesday, March 30, 2011 7:42 PM

Answers

  • You can manage this with policies, but you can also use the Port.ItemCount to find out how many messages are waiting and Port.Test to read messages. So your receiver should read all available items every time it is called and only process the last one.

    If you are doing this in a DSS service, you will need to post the messages from your handler to an internal port in your service. Otherwise the ItemCount will always be zero due to the service Interleave.

    Trevor

     

    Saturday, April 2, 2011 6:22 AM

All replies

  •  

    Just to get some dialog,

    Maybe I could configure my Arbiter

    http://msdn.microsoft.com/en-us/library/bb844997.aspx

    Maybe this would work...

    maybe I could the the Receive() method of the Arbitor with a predicate to ignore and drop old messages older than some time T

    public static Receiver<T> Receive<T>( bool persist, Port<T> port, Handler<T> handler, Predicate<T> predicate )

     

    Wednesday, March 30, 2011 8:31 PM
  • You can manage this with policies, but you can also use the Port.ItemCount to find out how many messages are waiting and Port.Test to read messages. So your receiver should read all available items every time it is called and only process the last one.

    If you are doing this in a DSS service, you will need to post the messages from your handler to an internal port in your service. Otherwise the ItemCount will always be zero due to the service Interleave.

    Trevor

     

    Saturday, April 2, 2011 6:22 AM