Skip to content

The receiver "doctrine" does not exist. Valid receivers are: doctrine. #225

@aluuraco

Description

@aluuraco

I'm getting the strange receiver does not exist error message when trying to initiate the messenger:consume command. Does anybody know what's wrong?

For some more context, I'm using this on a stand-alone Laminas MVC project and I've created a bin/console file to initiate the Command like the following:
php bin/console messenger:consume

The bin/console is written as follows:

#!/usr/bin/env php
<?php

use Netglue\PsrContainer\Messenger\Container\Command\DebugCommandFactory;
use Netglue\PsrContainer\Messenger\Container\Command\ConsumeCommandFactory;
use Symfony\Component\Console\Application as SymfonyConsoleApplication;
use Laminas\Mvc\Application as LaminasApplication;

// Set the correct path to Laminas bootstrap file
require 'vendor/autoload.php';

// Initialize Laminas application
$appConfig = require 'config/application.config.php';
$app = LaminasApplication::init($appConfig);
$serviceManager = $app->getServiceManager();

$consoleApp = new SymfonyConsoleApplication('symfony-console');
// Retrieve the actual command from the factory, not the factory itself
$consumeCommandFactory = new ConsumeCommandFactory();
$consumeMessagesCommand = $consumeCommandFactory($serviceManager);

$debugCommandFactory = new DebugCommandFactory();
$debugMessagesCommand = $debugCommandFactory($serviceManager);
// Add command to the console application
$consoleApp->add($consumeMessagesCommand);
$consoleApp->add($debugMessagesCommand);

// Run the console application
try {
	$consoleApp->run();
}catch (\Exception $exception){
    var_dump("CLI Error: " . $exception->getMessage());
}

I've also the following config written, following the examples provided in the docs folder of this library:

return [
    'dependencies' => [
        'factories' => [
	        'doctrine' => [TransportFactory::class, 'doctrine'],
        ],
    ],

	// And for Mezzio, this is how it expects. We define this separately in case the NetGlue package
	// does not work well with MVC.
	'symfony' => [
		'messenger' => [
			'doctrine' => [
				'dsn' => 'doctrine://doctrine.entitymanager.orm_default',
				'serializer' => SymfonySerializer::class,
			],
			
		]
	]
];

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions