Skip to content

Commit 0239b23

Browse files
authored
Update README.md
1 parent ae9cd6a commit 0239b23

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,18 +153,17 @@ print(event.event_path) # ['MainBus', 'AuthBus', 'DataBus'] # list of buses th
153153
Collect and aggregate results from multiple handlers:
154154

155155
```python
156-
async def config_handler_1(event):
156+
async def load_user_config(event):
157157
return {"debug": True, "port": 8080}
158158

159-
async def config_handler_2(event):
159+
async def load_system_config(event):
160160
return {"debug": False, "timeout": 30}
161161

162-
bus.on('GetConfig', config_handler_1)
163-
bus.on('GetConfig', config_handler_2)
162+
bus.on('GetConfig', load_user_config)
163+
bus.on('GetConfig', load_system_config)
164164

165-
event = await bus.dispatch(BaseEvent(event_type='GetConfig'))
166-
167-
# Merge all dict results
165+
# Get a merger of all dict results
166+
event = await bus.dispatch(GetConfig())
168167
config = await event.event_results_flat_dict()
169168
# {'debug': False, 'port': 8080, 'timeout': 30}
170169

0 commit comments

Comments
 (0)