47. class DefaultController extends AbstractController
{
public function index(MessageBusInterface $bus)
{
$bus->dispatch(new SmsNotification('A string to be sent...'));
}
}
48. class SmsNotificationHandler implements MessageHandlerInterface
{
public function __invoke(SmsNotification $message)
{
// do something with it.
}
}
No extra DI config needed, even tagging!