Download the PHP package jurry/amqp-symfony-bundle without Composer
On this page you can find all versions of the php package jurry/amqp-symfony-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package amqp-symfony-bundle
RabbitMQ symfony bundle v1.0
Description:
Its purpose is to initiate workers (consumers) and to send "sync" and "async" requests to another queues or exchanges.
Installation
Usage
After installing the bundle using composer, a new configuration file
created config/packages/jurry_rabbitmq.yaml. Let's take a look:
- As you see, you have a ready config yaml file, you can start editing these values as you need.
- The root attribute describes the service name, while the second attribute
connectiondescribes the connection string with RabbitMQ broker server.
Note: the connection attribute could be defined in two ways:
- Connection string, example: "tcp://guest:[email protected]:5672"
- Array definition
-
The third and last attribute is
queues_properties, which describes the config related to queues that should be defined once workers (consumers) started. -
Once you fit the config per your needs, you can start the workers (consumers) by running these commands:
- These two commands will create two queues for you, first one is "{name}_sync" and "{name}_async"
Workers (Consumers)
Workers (consumers) are looking for your registered services to initiate and execute the requested method inside them, So when another application requests an info from yours, they should send in the message body the following data:
Example: Assume service A asks service B for a random number
Service A will send this message to service B:
Service B will receive the message, then try to consume it, so, it should have the route "POST /api/number" to return a response
You have to set the base_uri as environment variable, just set these values in your .env file:
Request sender
In order to send requests to another queue, you can inject the RequestSender service inside any class you want, then:
Change Log
-
Now, this bundle makes http request to the requested route instead of calling the service class directly. This makes it easier and fully functional of using controllers, this will help to use validation, middlewares and other functionalities implemented in the controller.
- New environment values added:
These values will be used while initiating the http request inside the service itself
All versions of amqp-symfony-bundle with dependencies
php-amqplib/php-amqplib Version ^2.11
symfony/http-kernel Version *
symfony/config Version *
symfony/console Version *
symfony/validator Version *
guzzlehttp/guzzle Version ^7.1