Controller Methods
Method Signatures
Basic Handler Pattern
@staticmethod
async def handler_name(payload, client):
"""Handle messages without route parameters"""
# Process payload
return resultSingle Parameter Handler
@staticmethod
async def handler_name(param: str, payload, client):
"""Handle messages with one route parameter"""
# Process with parameter
return resultMultiple Parameters Handler
@staticmethod
async def handler_name(param1: str, param2: str, payload, client):
"""Handle messages with multiple route parameters"""
# Process with multiple parameters
return resultParameter Types
Route Parameters
Payload Parameter
Client Parameter
Handler Patterns
Fire and Forget
Request-Response
Publish-Subscribe
State Management
Advanced Patterns
Batch Processing
Pipeline Processing
Error Recovery
Method Organization
Grouping Related Methods
Separation of Concerns
Testing Controller Methods
Next Steps
Last updated