php-amqplib / RabbitMqBundle

RabbitMQ Bundle for the Symfony web framework
MIT License
1.22k stars 471 forks source link

[RFC] Added Stub producer #79

Closed lyrixx closed 10 years ago

lyrixx commented 11 years ago

Hello.

IMHO, it could be usefull to add a stub producer into this bundle (or in php-aqm lib) that will mock a producer. It will we usefull in functionnal tests to mock the real rabbitmq. Thanks to the data-collector, we could ask to the mock if new message has been pushed to rabbitmq, etc.

What do you think ?

stof commented 10 years ago

I think that the Fallback class was meant as a stub producer but it is totally broken. See #148 for the explanation.

However, if you want to avoid the real publishing while still collecting messages in the DataCollector (which is indeed useful for tests), a stub producer will not help you. The collector works at a lower level than the Producer (it is in the Channel class). A stub implementation would have to be done in PHP-AMQP at the connection level (which looks complex given the way it is written)

lyrixx commented 10 years ago

@stof thanks ;)

We are moving from this lib to the pecl one. So I did not need that anymore.