2017 © Pedro Peláez
 

library sqs-manager

Simple library that fetch and manage messages from SQS Queue

image

dirk39/sqs-manager

Simple library that fetch and manage messages from SQS Queue

  • Thursday, May 3, 2018
  • by dirk39
  • Repository
  • 2 Watchers
  • 1 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

SQS Manager

Build Status, (*1)

SQS Manager is a library that simplifies fetching of messages from a SQS Queue. SQS Manager reads messages from the queue you want, prepares a SQSManager\Message object and pass it to function or method you define. The main advantages of this libray are: - After the message has been depleted will be deleted from the queue by the Manager. - If an exception is caught by the Manager, remaining messages will be released and the caught exception will be thrown. - If the Manager retrieves several messages, it will pass them one by one to designed method/function. Afterwards the Manager will check VisibilityTimeout of remaining messages and in case of short expiry date, it will extend the expiration according to the VisibilityTimeout value. According to the AWS SQS documetation, the maximum timeout is 12 hours., (*2)

Installation

SQSManager can be installed by composer, (*3)

composer install dirk39/sqs-manager

Documentation

Usage of SQS Manager is very straightforward., (*4)

Construct

```php require_once 'vendor/autoload.php';, (*5)

$manager = new SQSManager\Manager('AWS_APP_ID', 'AWS_APP_SECRET', 'AWS_REGION', $additional_conf);, (*6)

``` In $additional_conf array you can add custom configuration for the Aws\Sqs\SqsClient. You can find more information about additional conf here., (*7)

#### Fetch messages ```php, (*8)

...., (*9)

$manager->run($queueName, $callback, $listenerConfigs);, (*10)

``` - $queueName: the name of the queue you need to fetch. $queue could be the name of the queue or its url. - $callback: $callback value will be passed to a call_user_func. Read the docs about acceptable $callback values. The Manager will pass a SQSManager\Message object to your callback function/method. - $listenerConfigs: additional configs pass to Aws\Sqs\SqsClient::receiveMessage method. For further information about allowed configs read here, (*11)

Manager configurators

  • changeVisibilityTimeout: change default VisibilityTimeout value. It must be an integer between and 0 and 43200 seconds (i.e. 12 hours)
  • setWaitTimeSeconds: change default WaitTimeSeconds value. It must be an integer between and 1 and 20 seconds.
  • setMaxNumberOfMessages: change default MaxNumberOfMessages value. It must be an integer between and 1 and 10., (*12)

    Testing

    To replicate integration tests you have to copy tests/config.example.php into tests/configs.php and replace default values for AWS_KEY, AWS_SECRET, AWS_REGION, AWS_QUEUE_NAME with your values. Important: AWS credentials must be of a user with read/write permission for Amazon SQS. At the end of the tests, designed queue will be purged of all messages so don't use production SQS queue!, (*13)

The Versions

03/05 2018

dev-master

9999999-dev

Simple library that fetch and manage messages from SQS Queue

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andrea Quintino

03/05 2018

v1.0.2

1.0.2.0

Simple library that fetch and manage messages from SQS Queue

  Sources   Download

MIT

The Requires

 

The Development Requires

by Andrea Quintino

03/05 2018

dev-documentation

dev-documentation

Trait class that helps class to fetch SQS queue and manage messages

  Sources   Download

The Requires

 

The Development Requires

by Andrea Quintino

01/05 2018

v1.0.1

1.0.1.0

Simple library that fetch and manage messages from SQS Queue

  Sources   Download

The Requires

 

The Development Requires

by Andrea Quintino

28/04 2018

v1.0.0

1.0.0.0

Trait class that helps class to fetch SQS queue and manage messages

  Sources   Download

The Requires

 

The Development Requires

by Andrea Quintino

31/03 2018

dev-message

dev-message

Trait class that helps class to fetch SQS queue and manage messages

  Sources   Download

The Requires

 

by Andrea Quintino