Download the PHP package opsource/rabbitmq without Composer
On this page you can find all versions of the php package opsource/rabbitmq. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download opsource/rabbitmq
More information about opsource/rabbitmq
Files in opsource/rabbitmq
Package rabbitmq
Short Description RabbitMQ client laravel
License MIT
Homepage https://github.com/vahidaghazadeh/queryadapter
Informations about the package rabbitmq
RabbitMQ Queue driver Laravel
Version | Laravel support | Last update |
---|---|---|
1.0.3 | 9-10-11 | 26 June 2024 |
Installation
You can install this package using this composer:
Configuration
After installation, the package will be published automatically You can find the package configuration file in the path
To use the package, you need to include the following environment variables in your project's ``.env'' file.
RabbitMQ Environment Variables
This section outlines the RabbitMQ environment variables used to configure the connection and behavior of the RabbitMQ client. Optional environment variables that you can use to develop your application
Variable | Description |
---|---|
RABBITMQ_HOST |
The hostname or IP address of the RabbitMQ server. Default: 127.0.0.1 . |
RABBITMQ_PORT |
The port number on which RabbitMQ is running. Default: 5672 . |
RABBITMQ_USERNAME |
The username for authenticating with RabbitMQ. Default: admin . |
RABBITMQ_PASSWORD |
The password for authenticating with RabbitMQ. Default: admin . |
RABBITMQ_VHOST |
The virtual host to use when connecting to RabbitMQ. Default: / . |
RABBITMQ_WORKER |
The worker mode for message delivery. Default: DELIVERY_MODE_NON_PERSISTENT . |
RABBITMQ_CONNECTION |
The name of the RabbitMQ connection. Default: rabbitmq . |
RABBITMQ_MESSAGE_DELIVERY_MODE |
The delivery mode for messages. Default: DELIVERY_MODE_PERSISTENT . |
RABBITMQ_EXCHANGE_NAME |
The name of the exchange. Default: / . |
RABBITMQ_EXCHANGE_DECLARE |
Whether to declare the exchange. Default: false . |
RABBITMQ_EXCHANGE_TYPE |
The type of exchange (e.g., direct, fanout, topic, headers). Default: [direct fanout topic headers direct] . |
RABBITMQ_EXCHANGE_PASSIVE |
Whether the exchange is passive. Default: false . |
RABBITMQ_EXCHANGE_DURABLE |
Whether the exchange should be durable. Default: true . |
RABBITMQ_EXCHANGE_AUTO_DEL |
Whether the exchange should be auto-deleted. Default: false . |
RABBITMQ_EXCHANGE_INTERNAL |
Whether the exchange is internal. Default: false . |
RABBITMQ_EXCHANGE_NOWAIT |
Whether to wait for the exchange to be declared. Default: false . |
RABBITMQ_QUEUE_DECLARE |
Whether to declare the queue. Default: false . |
RABBITMQ_QUEUE_PASSIVE |
Whether the queue is passive. Default: false . |
RABBITMQ_QUEUE_DURABLE |
Whether the queue should be durable. Default: true . |
RABBITMQ_QUEUE_EXCLUSIVE |
Whether the queue is exclusive. Default: false . |
RABBITMQ_QUEUE_AUTO_DEL |
Whether the queue should be auto-deleted. Default: false . |
RABBITMQ_QUEUE_NOWAIT |
Whether to wait for the queue to be declared. Default: false . |
RABBITMQ_CONSUMER_TAG |
The consumer tag. Default: '' (empty string). |
RABBITMQ_CONSUMER_NO_LOCAL |
Whether to consume messages locally. Default: false . |
RABBITMQ_CONSUMER_NO_ACK |
Whether to acknowledge messages automatically. Default: false . |
RABBITMQ_CONSUMER_EXCLUSIVE |
Whether the consumer is exclusive. Default: false . |
RABBITMQ_CONSUMER_NOWAIT |
Whether to wait for the consumer. Default: false . |
RABBITMQ_CONSUMER_SLEEP_MS |
The sleep duration in milliseconds for the consumer. Default: 1000 . |
RABBITMQ_QOS_ENABLED |
Whether Quality of Service (QoS) is enabled. Default: false . |
RABBITMQ_QOS_PREF_SIZE |
The prefetch size for QoS. Default: 0 . |
RABBITMQ_QOS_PREF_COUNT |
The prefetch count for QoS. Default: 1 . |
RABBITMQ_QOS_GLOBAL |
Whether QoS is global. Default: false . |
These environment variables help configure the RabbitMQ connection and control various behaviors of the RabbitMQ client.
RabbitMQ Integration Documentation
This document outlines the usage of the RabbitMQManager in your application.
Initialization
First, create an instance of the RabbitMQManager
class using the application container:
Alternatively, you can retrieve the RabbitMQ instance directly from the application container using the alias rabbitmq:
Constructor Dependency Injection
To inject the RabbitMQManager into a class using constructor dependency injection, define your class constructor to accept a RabbitMQManager instance:
Getting RabbitMQ Connections
You can retrieve the list of all RabbitMQ connections using the getConnections method provided by the RabbitMQ facade:
Complete Example
Here’s a complete example of how to use RabbitMQManager in a class:
Key Points
- Initialization: You can initialize the RabbitMQManager either directly or through the application container.
- Dependency Injection: Use constructor dependency injection to inject the RabbitMQManager into your classes.
- Connections: Retrieve all RabbitMQ connections using RabbitMQ::getConnections().
This documentation provides a clear and concise explanation of how to use the RabbitMQManager
and related functionalities in your application. It covers initialization, dependency injection, and retrieving connections, along with a complete example for better understanding.
RabbitMQ Integration Documentation
This document provides an overview and examples of how to use RabbitMQ for publishing and consuming messages, resolving connections and channels, and configuring the RabbitMQ setup in your application.
Publishing Messages
Single Message Publishing
To publish a single message to the default exchange/topic/queue:
Publish to the default exchange/topic/queue $rabbitMQ->publisher()->publish($message);
Bulk Messages
Publish multiple messages at once:
Consume Messages
Consume through a Closure
Define a handler using a closure to consume messages:
Consume through a Class
Define a handler using a class to consume messages:
Interact with RabbitMQ
Resolve the Default Connection
Get the default connection:
Resolve the Default Channel
Get the default channel:
Configuration
Connection Configuration
Override the default connection configuration:
Message Configuration
Configure the message properties:
Publish Configuration
Configure the publisher and publish a message with specific settings:
Consumer Configuration
Configure the consumer settings:
Example
Running a Consumer
-
Create a Custom Command:
-
Register the Command in
app/Console/Kernel.php
: -
Consume through the Handler:
- Call the Command from the Console:
Publishing Messages
-
Create Route <-> Controller Binding:
- Create a Controller to Publish Messages:
By following this documentation, you can effectively publish and consume messages using RabbitMQ in your application.
This documentation provides a comprehensive guide on how to set up, configure, publish, and consume messages using RabbitMQ, along with example code and commands for better understanding.
License
The MIT License (MIT). Please see License File for more information.
All versions of rabbitmq with dependencies
ext-json Version *
illuminate/support Version ^9.0|^10.0|11.*
php-amqplib/php-amqplib Version ^v3.6.2