Buy me a cup of coffee 

Software development is powered by coffee... if you use any of our open source pojects, it would make my day if you'd buy me a cup (or several). Just click on the coffee cup.

Rate Limiting Transactions with ASCOM ReactiveCommunications

Tags: ASCOM, software, software-engineering, development, developers, reactive-extensions, open-source, beta

Our open-source project ASCOM.ReactiveCommunications has been updated to support rate limiting of transactions. An optional parameter has been added to the ReactiveTransactionProcessor.SubscrieTransactionObserver method which allows the client to set the minimum interval between transactions. This is done in such a way that it will work no matter which thread the transaction was queued on (all transactions are serialized and processed one at a time). If the parameter is not specified, or is null, then zero is assumed and no rate limiting is performed.

The method signature becomes:

public void SubscribeTransactionObserver(TransactionObserver observer, TimeSpan? rateLimit=null)

To use this new feature, call as follows (note the gap argument):

public void Open()
    {
    var reactiveProcessor = new ReactiveTransactionProcessor();
    var observer = new TransactionObserver(channel);
    Open(reactiveProcessor, observer);
    var gap = TimeSpan.FromMilliseconds(Settings.Default.AwrMinimumMillisecondsBetweenTransactions);
    reactiveProcessor.SubscribeTransactionObserver(transactionObserver, gap);
    channel.Open();
    }

This feature is first available in build 0.1.1-Beta.1021 (branch beta/0.1.1)

No Comments

Add a Comment

TeamCity Build Status

Let Us Help You

Find us on Facebook