Skip to content

Commit 32fb82c

Browse files
Matthew WeppennaarMatthew Weppennaar
authored andcommitted
adding different notation for methods
1 parent 1c3e0c8 commit 32fb82c

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

docs/middleware/building_your_own_middleware.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ A middleware class provides three handler functions, one for processing each of
55

66
Although transport and application middleware potentially both provide the same sets of handlers, the two make use of them in slightly different ways. Inbound messages and events are published by transports but consumed by applications while outbound messages are opposite.
77

8-
A middleware is required to subclass BaseMiddleware. This is a convenient definition of and set of common functionality for middleware classes. However you should not override :py:data:`__init__()`. Custom setup should be done in
9-
:py:data:`setup()` instead (if required). The config class can be overidden by replacing the :py:data:`config` variable.
10-
You should also overwrite :py:data:`handle_{type}(self, msg, connection)` in most cases while using :py:data:`{type}_enabled(self, connector_name)` from the base class
8+
A middleware is required to subclass BaseMiddleware. This is a convenient definition of and set of common functionality for middleware classes. However you should not override :py:meth:`__init__()`. Custom setup should be done in
9+
:py:meth:`setup()` instead (if required). The config class can be overidden by replacing the :py:meth:`config` variable.
10+
You should also overwrite :py:meth:`handle_{type}(self, msg, connection)` in most cases while using :py:meth:`{type}_enabled(self, connector_name)` from the base class
1111

1212

1313
See logging and unidecoder examples
@@ -18,10 +18,10 @@ How your middleware is used inside Vumi:
1818
While writing complex middleware, it may help to understand how a middleware class is used by Vumi transports and applications.
1919

2020
When a transport or application is started a list of middleware to load is read from the configuration.
21-
An instance of each piece of middleware is created and then ``setup()`` is called on each middleware object in
22-
order within the ``setup()`` of the worker
21+
An instance of each piece of middleware is created and then :py:meth:`setup()` is called on each middleware object in
22+
order within the :py:meth:`setup()` of the worker
2323

24-
``middleware_{type}_handler function`` (e.g., middleware_outbound_handler) of BaseWorker of each message type. This function will:
25-
Filter the middleware list based on connector_name and the middleware's ``{type}_enabled`` method.
26-
Create a decorated handler function that sequentially applies each enabled middleware's ``handle_{type}`` method to the message.
24+
:py:meth:`middleware_{type}_handler` function (e.g., middleware_outbound_handler) of BaseWorker of each message type. This function will:
25+
Filter the middleware list based on connector_name and the middleware's :py:meth:`{type}_enabled` method.
26+
Create a decorated handler function that sequentially applies each enabled middleware's :py:meth:`handle_{type}` method to the message.
2727
Return the decorated handler. This decorated handler is then used in setting up the connection

0 commit comments

Comments
 (0)