Skip to content

Commit 4d7398f

Browse files
committed
#17378: Add documentation for allow_no_senders
1 parent e29a873 commit 4d7398f

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

messenger/multiple_buses.rst

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ an **event bus**. The event bus could have zero or more subscribers.
3636
event.bus:
3737
# the 'allow_no_handlers' middleware allows to have no handler
3838
# configured for this bus without throwing an exception
39-
default_middleware: allow_no_handlers
39+
# the 'allow_no_senders' middleware allows to have no sender
40+
# configured for this bus without throwing an exception
41+
default_middleware:
42+
enabled: true
43+
allow_no_handlers: false
44+
allow_no_senders: true
4045
middleware:
4146
- validation
4247
@@ -64,7 +69,10 @@ an **event bus**. The event bus could have zero or more subscribers.
6469
</framework:bus>
6570
<!-- the 'allow_no_handlers' middleware allows to have no handler
6671
configured for this bus without throwing an exception -->
67-
<framework:bus name="event.bus" default-middleware="allow_no_handlers">
72+
<!-- the 'allow_no_senders' middleware allows to have no sender
73+
configured for this bus without throwing an exception -->
74+
<framework:bus name="event.bus">
75+
<framework:default-middleware enabled="true" allow_no_handlers="false" allow_no_senders="true"/>
6876
<framework:middleware id="validation"/>
6977
</framework:bus>
7078
</framework:messenger>
@@ -88,9 +96,15 @@ an **event bus**. The event bus could have zero or more subscribers.
8896
$queryBus->middleware()->id('validation');
8997
9098
$eventBus = $framework->messenger()->bus('event.bus');
91-
// the 'allow_no_handlers' middleware allows to have no handler
99+
// the 'allowNoHandlers' middleware allows to have no handler
100+
// configured for this bus without throwing an exception
101+
// the 'allowNoSenders' middleware allows to have no sender
92102
// configured for this bus without throwing an exception
93-
$eventBus->defaultMiddleware('allow_no_handlers');
103+
$eventBus->defaultMiddleware()
104+
->enabled(true)
105+
->allowNoHandlers(false)
106+
->allowNoSenders(true)
107+
;
94108
$eventBus->middleware()->id('validation');
95109
};
96110

0 commit comments

Comments
 (0)