-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
If we have:
...
channels:
channel1:
messages:
Message1: ...
Message2: ...
Message3: ...
operations:
op1:
action: receive
channel: { $ref: "#/channels/channel1" }
...
...One would have to match over messages, while handling:
@app.consumer.op1
async def op(msg: Message1 | Message2 | Message3):
match msg:
case Message1():
await handle1(msg)
case Message2():
await handle2(msg)
case Message3():
await handle2(msg)We should move match logic to the level of the framework, having something like:
@app.consumer.op1(matches=(Message1, Message2))
async def handle12(msg: Message1 | Message2):
...
@app.consumer.op2(matches=[Message3])
async def handle3(msg: Message3):
...The framework should raise a NotImplementedError, if at least one of the cases is unmatched during app.start call, and it must not allow two handlers for the same message-operation pair
Metadata
Metadata
Assignees
Labels
No labels