praekelt/vumi — pull request #437 by overnin (2012-12-06 18:48:27+00:00)
Title: add window manager within middleware

I tried to embed the window manager in a middleware in order to slow down my SMPP transport when the aggregator don't use SMPP's Throttling mechanism. It's a first try and questions are still open and i would need some directions on the 2 following points

1> How to cancel the following middlewareStack and the worker execution? Two options were identified returning None or throwing an exception like "StopPropagation". None is not very explicit which can lead to mistake when deploying pile of middlewares. Also there is this rule already in the code that 'Return value should never be none'. An exception "StopPropagation" is more explicit but i don't get all the implication that it might have.

2> How to resume the middlewareStack execution when a message is due to be send? in my code i directly call the worker to send the message... but then i'm bypassing all the following middlewares of the worker.