Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 62 | All time: 10,456 This week: 455 |
Version | License | PHP version | Categories | |||
aws-sqs-wrapper 1.0 | BSD License | 5 | PHP 5, Tools, Web services |
Description | Author | |||||||||||||||||||||||
This package can publish and subscribe message queues using AWS SQS. Innovation Award |
|
PHP library for simplified SQS queue messages processing.
composer require ndthuan/aws-sqs-wrapper
use Aws\Sqs\SqsClient;
use Ndthuan\AwsSqsWrapper\Publishing\Publisher;
use Ndthuan\AwsSqsWrapper\Queue\Connector;
$queueUrl = ''; // get this from your own AWS SQS setup
// creating a publisher
$sqsClient = new SqsClient(...);
$queueConnector = new Connector($sqsClient, $queueUrl);
$publisher = new Publisher($queueConnector);
// send a string message
$publisher->publishString('My message body');
// or send a json serializable object/array
$myMessage = [
'my' => 'data',
];
$publisher->publishJsonSerializable($myMessage);
use Aws\Sqs\SqsClient;
use Ndthuan\AwsSqsWrapper\Queue\Connector;
use Ndthuan\AwsSqsWrapper\Queue\ReceivedMessage;
use Ndthuan\AwsSqsWrapper\Queue\ResultMetadata;
use Ndthuan\AwsSqsWrapper\Subscribing\DelegatorSubscriber;
// defining a message processor
class MyMessageProcessor implements MessageProcessorInterface
{
/
* @inheritdoc
*/
public function processMessage(ReceivedMessage $message, ResultMetadata $resultMetadata)
{
// your processing logic
}
}
$queueUrl = ''; // get this from your own AWS SQS setup
// creating a subscriber
$sqsClient = new SqsClient(...);
$queueConnector = new Connector($sqsClient, $queueUrl);
$subscriber = new DelegatorSubscriber(new MyMessageProcessor(), $queueConnector);
// run the subscriber
$subscriber->pullAndProcessMessages();
A message processor may throw exceptions or errors. Subscriber will react differently depending on exception type:
Files (35) |
File | Role | Description | ||
---|---|---|---|---|
src (3 directories) | ||||
tests (1 file, 2 directories) | ||||
.travis.yml | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
docker-compose.yml | Data | Auxiliary data | ||
install-xdebug.sh | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
phpunit.xml.dist | Data | Auxiliary data | ||
README.md | Doc. | Documentation | ||
run_tests.sh | Data | Auxiliary data | ||
run_tests_with_coverage.sh | Data | Auxiliary data | ||
wait_for.sh | Data | Auxiliary data |
Files (35) | / | src |
File | Role | Description | ||
---|---|---|---|---|
Publishing (1 file) | ||||
Queue (6 files) | ||||
Subscribing (6 files, 2 directories) |
Files (35) | / | src | / | Queue |
File | Role | Description |
---|---|---|
Connector.php | Class | Class source |
MessageAttributes.php | Class | Class source |
ReceivedMessage.php | Class | Class source |
ReceiveMessageResult.php | Class | Class source |
ResultMetadata.php | Class | Class source |
SendMessageResult.php | Class | Class source |
Files (35) | / | src | / | Subscribing |
File | Role | Description | ||
---|---|---|---|---|
Callbacks (3 files) | ||||
Exception (3 files) | ||||
AbstractSubscriber.php | Class | Class source | ||
DelegatorSubscriber.php | Class | Class source | ||
MessageProcessorInterface.php | Class | Class source | ||
MessageValidatorInterface.php | Class | Class source | ||
SubscriberInterface.php | Class | Class source | ||
SubscribingException.php | Class | Class source |
Files (35) | / | src | / | Subscribing | / | Callbacks |
File | Role | Description |
---|---|---|
LoggingCallbacks.php | Class | Class source |
NullCallbacks.php | Class | Class source |
SubscriberCallbacksInterface.php | Class | Class source |
Files (35) | / | src | / | Subscribing | / | Exception |
File | Role | Description |
---|---|---|
FatalException.php | Class | Class source |
LogicException.php | Class | Class source |
ValidationFailureException.php | Class | Class source |
Files (35) | / | tests |
File | Role | Description | ||
---|---|---|---|---|
integration (1 file) | ||||
unit (3 directories) | ||||
bootstrap.php | Aux. | Auxiliary script |
Files (35) | / | tests | / | unit |
File | Role | Description | ||
---|---|---|---|---|
Publishing (1 file) | ||||
Queue (1 file) | ||||
Subscribing (1 file, 1 directory) |
Files (35) | / | tests | / | unit | / | Queue |
File | Role | Description |
---|---|---|
MessageAttributesTest.php | Class | Class source |
Files (35) | / | tests | / | unit | / | Subscribing |
File | Role | Description | ||
---|---|---|---|---|
Callbacks (1 file) | ||||
DelegatorSubscriberTest.php | Class | Class source |
Files (35) | / | tests | / | unit | / | Subscribing | / | Callbacks |
File | Role | Description |
---|---|---|
LoggingCallbacksTest.php | Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.