Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
DummyBatchHandler example
$expectedMessages
=
[
new
DummyMessage
(
'Hey'
)
,
new
DummyMessage
(
'Bob'
)
,
]
;
$receiver
=
new
DummyReceiver
(
[
[
new
Envelope
(
$expectedMessages
[
0
]
)
]
,
[
new
Envelope
(
$expectedMessages
[
1
]
)
]
,
]
)
;
$handler
=
new
DummyBatchHandler
(
)
;
$middleware
=
new
HandleMessageMiddleware
(
new
HandlersLocator
(
[
DummyMessage::
class
=>
[
new
HandlerDescriptor
(
$handler
)
]
,
]
)
)
;
$bus
=
new
MessageBus
(
[
$middleware
]
)
;
$dispatcher
=
new
EventDispatcher
(
)
;
$dispatcher
->
addListener
(
WorkerRunningEvent::
class
,
function
DWorkerRunningEvent
$event
)
use
(
$receiver
)
{
static
$i
= 0;
if
(
1 < ++
$i
)
{