enqueue-dev: [Symfony bundle] Unable to test message queue
According to the documentation, to test if a message has been sent - you have to have a TraceableProducer class. To get this class one should call ...client->getContainer()->get(TraceableProducer::class);
. Unfortunately, this yields an error:
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException : You have requested a non-existent service "Enqueue\Client\TraceableProducer".
Would someone please explain to me how should I test that the message has been sent properly and why am I getting this error?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (16 by maintainers)
Well, that confirms that you’re receiving mapping twice and the first one gets selected, when
DoctrineRegistry
is asked forEntityManagerInterface
that handles JobQueue entities.As I said, remove mapping injection from your fork if you need it working immediately and then we’ll focus on providing the option to specify which entity manager instance should receive the mapping and correct the docs.
@balabis You actually don’t have to. See:
https://github.com/php-enqueue/enqueue-dev/blob/97e2f99ca1533dbe4819db9206ee69301968af1b/pkg/redis/RedisProducer.php#L44-L72
Redis producer will throw an exception if connection Redis instance is not possible or Redis is unable to store it (if you’re not familiar with Redis, keep in mind that saving to disk requires it to temporarily double it’s RAM usage, which is a known pitfall - see Redis FAQ ).
If you haven’t got an exception, then a message should be stored on Redis. You can check this by taking your Redis offline and trying to send.
EDIT: Traceable Producer is really meant for functional testing, i.e. checking that your message goes through during tests without actually connecting to broker (which you can keep offline on those tests with proper configuration)
EDIT: I’m closing this issue since it seems that this discussion should be exhausted. If you have further questions feel free to ask them.