Download the PHP library bernard/bernard-bundle
On this page you can find all versions of the php package bernard/bernard-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
All versions of bernard-bundle with dependencies
Informations about the package bernard-bundle
Integrates Bernard neatly with a Symfony application.
Everything starts by installing the bundle. This is done through composer by adding the following lines
composer.json file and running
composer update bernard/bernard-bundle.
Next up is adding the bundle to your kernel and configuring it in
Great! You are now ready to use this diddy. Go and read the rest of the documentation on Bernard at bernard.readthedocs.org.
Running the Consumer
What good is a message queue if you don't know how to run the consumer? Luckily this bundle auto registers the commands
with your application. So if you run
php app/console you should see
work just as the documentation describes but if you are in doubt just add
--help when running the command.
It is important to use
--no-debug when running the consumer for longer periods of time. This is because Symfony by
default in debug mode collects a lot of information and logging and if this is omitted you will run into memory problems
sooner or later.
In order to know what messages needs to go where you have to register some receivers. This is done with a tag in your service definitions.
As the example shows it is possible to register the same receiver for many different message types.
There are different options that can be set that changes the behaviour for various drivers.
When using the doctrine driver it can be useful to use a seperate connection when using Bernard. In order to
change it use the
connection option. This also needs to be set if you default connection is called anything else
The file driver needs to know what directory it should use for storing messages and its queue metadata.
The above example will dump your messages in the cache folder. In most cases you will want to change this to something because the cache folder is deleted every time the cache is cleared (obviously).
PhpAmqp / RabbitMQ
PhpAmqp depends on a service called
old_sound_rabbit_mq.connection.default with a configured connection instance that extends
If you want to use a different name use the
You need to define the
phpamqp_exchange. Optional, you can define
PhpRedis depends on a service called
snc_redis.bernard with a configured
Redis instance. If you want to use a
different name use the
If you're using the SncRedisBundle you have to set logging to false for the
bernhard client to ensure that is is a
Redis instance and not wrapped. Also, if the consumer is throwing
RedisException: read error on connection, you need to set
connection_timeout (see SncRedisBundle configuration options) option to a value higher than 5 (seconds).
When using the IronMQ driver you have to configure an
IronMQ connection instance. You can configure it like the following:
To use Amazon SQS, configure your driver like this:
To use Pheanstalk (pda/pheanstalk), configure your driver like this: