interface MessageSubscriberInterface implements MessageHandlerInterface

Handlers can implement this interface to handle multiple messages.

Methods

static iterable
getHandledMessages()

Returns a list of messages to be handled.

Details

at line 46
static iterable getHandledMessages()

Returns a list of messages to be handled.

It returns a list of messages like in the following example:

return [MyMessage::class];

It can also change the priority per classes.

return [
    [FirstMessage::class, 0],
    [SecondMessage::class, -10],
];

It can also specify a method and/or a priority per message:

return [
    FirstMessage::class => 'firstMessageMethod',
    SecondMessage::class => ['secondMessageMethod', 20],
];

The __invoke method of the handler will be called as usual with the message to handle.

Return Value

iterable