BaseMiddleware class¶
fastpubsub.BaseMiddleware
¶
Base class for middlewares.
Your middlewares should extend this class if you want to implement your own middleware.
Initializes the BaseMiddleware.
| PARAMETER | DESCRIPTION |
|---|---|
next_call
|
The next middleware or command in the chain.
TYPE:
|
Source code in fastpubsub/middlewares/base.py
on_message
async
¶
Handles a message.
When extending this methods, you should always call
await super().on_message(...) to continue the chain.
| PARAMETER | DESCRIPTION |
|---|---|
message
|
The message to handle.
TYPE:
|
Source code in fastpubsub/middlewares/base.py
on_publish
async
¶
Handles a publish event.
When extending this methods, you should always call
await super().on_publish(...) to continue the chain.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
The message data.
TYPE:
|
ordering_key
|
The ordering key for the message.
TYPE:
|
attributes
|
A dictionary of message attributes. |
Source code in fastpubsub/middlewares/base.py
Middleware class¶
fastpubsub.Middleware
¶
Wrapper class for middlewares.
You should only use this class to create middlewares on class constructors. Its purpose is to only store the middleware information for delayed initiatization.
Initializes the Middleware.
| PARAMETER | DESCRIPTION |
|---|---|
cls
|
The middleware class you want to initialize later.
TYPE:
|
args
|
The middleware class positional arguments.
TYPE:
|
kwargs
|
The middleware class keyword arguments.
TYPE:
|