Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2025-04-14 (5 days ago)  | | Not yet rated by the users | | Total: Not yet counted | | Not yet ranked |
|
Description | | Author |
This package can manage queues of messages using protocol buffers.
It provides a demonstration package that uses Google Protocol Buffers libraries to perform operations on messages that are sent from consumer tasks to worker task that can perform useful jobs.
Currently, the package can:
- Create a queue of tasks
- Let consumers send messages to a queue
- Let workers receive queued messages | |
 |
|
Innovation award
 Nominee: 17x
Winner: 2x |
|
Instructions
Example
<?php
require_once __DIR__ . '/../vendor/autoload.php';
use Aws\Sqs\SqsClient;
use Aws\Exception\AwsException;
$sqsClient = new SqsClient([
'version' => 'latest',
'region' => 'us-east-1',
'endpoint' => 'http://localhost:4566',
]);
$queueUrl = 'http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/testing-queue';
try {
$result = $sqsClient->receiveMessage([
'QueueUrl' => $queueUrl,
'MaxNumberOfMessages' => 1,
'VisibilityTimeout' => 0,
'WaitTimeSeconds' => 0,
]);
$messages = $result->get('Messages');
if (! $messages) {
dd('No messages');
}
foreach ($messages as $message) {
$gameDeserialized = new Game();
$gameDeserialized->mergeFromString($message['Body']);
echo 'game found : ' . $gameDeserialized->getName() . PHP_EOL;
$sqsClient->deleteMessage([
'QueueUrl' => $queueUrl,
'ReceiptHandle' => $message['ReceiptHandle'],
]);
}
} catch (AwsException $e) {
dump($e->getMessage());
}
|
Details
proto-x-bus

Creating prototypes :
protoc --proto_path=proto/ --php_out=worker/Protos game.proto
protoc --proto_path=proto/ --php_out=consumer/Protos game.proto
Starting bus :
docker run -d -p 4566:4566 -p 4510-4559:4510-4559 localstack/localstack
Creating queue :
aws --endpoint-url=http://localhost:4566 --region us-east-1 sqs create-queue --queue-name testing-queue
Usage :
php worker/src/run.php
php consumer/src/run.php
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.