Internal Middlewares¶
fastpubsub.middlewares.HandleMessageSerializerMiddleware
¶
Bases: BaseMiddleware
A special middleware for handling incoming messages serialization.
Initializes the HandleMessageSerializerMiddleware.
| PARAMETER | DESCRIPTION |
|---|---|
next_call
|
The next call to the middleware chain.
TYPE:
|
target
|
The target callable to handle the message. An async function runs on the event loop. A sync function runs in the thread pool.
TYPE:
|
Source code in fastpubsub/middlewares/di.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
fastpubsub.middlewares.PublishMessageSerializerMiddleware
¶
Bases: BaseMiddleware
A special middleware for publishing messages serialization.
Initializes the PublishMessageSerializerMiddleware.
| PARAMETER | DESCRIPTION |
|---|---|
next_call
|
The next call to the middleware chain.
TYPE:
|
project_id
|
The Google Cloud project ID.
TYPE:
|
topic_name
|
The name of the topic.
TYPE:
|
autocreate
|
Whether to automatically create the topic.
TYPE:
|
Source code in fastpubsub/middlewares/di.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
¶
Publishes a message.
| PARAMETER | DESCRIPTION |
|---|---|
data
|
The message data.
TYPE:
|
ordering_key
|
The ordering key for the message.
TYPE:
|
attributes
|
A dictionary of message attributes. |