PHPackages                             symbiote/silverstripe-sqs-jobqueue - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. symbiote/silverstripe-sqs-jobqueue

ActiveSilverstripe-vendormodule

symbiote/silverstripe-sqs-jobqueue
==================================

A module for interacting with AWS's Simple Queue Service (SQS)

4.0.0(1y ago)29.4k↓100%7[2 issues](https://github.com/nyeholt/silverstripe-sqs-jobqueue/issues)[2 PRs](https://github.com/nyeholt/silverstripe-sqs-jobqueue/pulls)1BSD-3-ClausePHP

Since Sep 2Pushed 1y ago3 watchersCompare

[ Source](https://github.com/nyeholt/silverstripe-sqs-jobqueue)[ Packagist](https://packagist.org/packages/symbiote/silverstripe-sqs-jobqueue)[ RSS](/packages/symbiote-silverstripe-sqs-jobqueue/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)DependenciesVersions (20)Used By (1)

SilverStripe SQS job queue
==========================

[](#silverstripe-sqs-job-queue)

A module for sending and consuming SQS tasks. Can be configured to work as the trigger for queuejobs.

When used as the queuedjobs handler, there's a few slight changes to how queuedjobs are run - aside from not needing Cron jobs anymore.

- On calling QueuedJobService-&gt;queueJob, a message is sent to SQS
- A consumer picks up that message, then processes that job ID
- All "type 1" aka immediate jobs are subsequently processed in that execution thread
- If the added job is meant to be run in the future, the handler sets the job type to 'Scheduled'.
- A separate SQS task runs that looks for any jobs of type "Scheduled" and executes those
- That task re-queues itself for to run again in 30 seconds time
- The "Scheduled" task runner will also look for any job currently sitting in the "wait" status; this is how paused jobs get picked up for further execution without needing to trigger another SQS message

Configuration for use as the queuejobs handler
----------------------------------------------

[](#configuration-for-use-as-the-queuejobs-handler)

```
---
Name: jobrunner
After: queuedjobs
---
SilverStripe\Core\Injector\Injector:
  QueueHandler:
    class: Symbiote\SqsJobQueue\Service\SqsQueueHandler
    properties:
      sqsService: '%$SqsService'
  SqsClient:
    class: Aws\Sqs\SqsClient
    constructor:
      connection_details:
        region: ap-southeast-2
        version: latest
        credentials:
          key: YourKey
          secret: YourSecret

```

That expects a queue to exist with the name 'jobqueue' - if the queue name is different,

```
SilverStripe\Core\Injector\Injector:
  SqsService:
    properties:
      queueName: your-queue-name

```

Writing a task
--------------

[](#writing-a-task)

Define a class with a method in it. This is the task runner; no need for any specific implementations.

eg

```
namespace \Whatever\Class\Implements;

class Work {

    public function doStuff() {

    }
}
```

Add configuration to your project that binds the method name to the SqsService

```
SilverStripe\Core\Injector\Injector:
  MyJobName:
    class: \Whatever\Class\Implements\Work
  SqsService:
    properties:
      handlers:
        doStuff: %$MyJobName
```

Triggering tasks
----------------

[](#triggering-tasks)

To trigger a task, the call

`$sqsService->sendSqsMessage(['args' => ['param1', 'param2']], 'taskName');`

for convenience, SqsService implements a `__call()` method that remaps a call like

`$sqsService->taskName($arg1, $arg2)`

into

`$sqsService->sendSqsMessage(['args' => [$arg1, $arg2']], 'taskName');`

`sendSqsMessage` in turn converts this into a message structure such as

```
$message = [
    'message' => [
        'args' => [$arg1, $arg2'],
        'handler' => 'taskName',
    ]
];

$sqsMessage = [
    'QueueUrl' => 'sqs://in.amazon'
    'MessageBody' => json_encode($message)
];
```

So, to manually trigger the messages, create the `$sqsMessage` structure from your own code, and send using `$this->client->sendMessage($sqsMessage);`

Running
-------

[](#running)

```
php vendor/symbiote/silverstripe-sqs-jobqueue/sqs-worker.php

```

Development environments
------------------------

[](#development-environments)

If you don't have SQS available, you can run a file-based queue system by swapping out the AWS queue for the file based SQS queue.

```
---
Name: local_sqs_config
After: '#sqs_config'
---
SilverStripe\Core\Injector\Injector:
  SqsService:
    properties:
      client: '%$FileSqsClient'
  FileSqsClient:
    class: Symbiote\SqsJobQueue\Service\FileBasedSqsQueue

```

By default, this will create serialised data in sqs-jobqueue/code/service/.queueus (configurable on the FileBasedSqsQueue class).

Run sqs-worker as before.

### Docker

[](#docker)

If you're using , this will spin up an `sqsrunner` container for you that runs the sqs-worker automatically.

### Troubleshooting

[](#troubleshooting)

So for a project, your config may look something like this where it defaults to the file-based queue system only for test environments:

```
---
Name: prod_sqs
After: '#sqs_config'
---
SilverStripe\Core\Injector\Injector:
  Symbiote\SqsJobQueue\Service\SqsService:
    properties:
      client: '%$SqsClient'
  SqsClient:
    class: Aws\Sqs\SqsClient
    constructor:
      connection_details:
        region: ap-southeast-2
        version: latest
---
Name: dev_sqs
After: '#sqs_config'
Only:
  environment: test
---
SilverStripe\Core\Injector\Injector:
  Symbiote\SqsJobQueue\Service\SqsService:
    properties:
      client: '%$Symbiote\SqsJobQueue\Service\FileBasedSqsQueue'

```

In the production environment you will still need to provide the `credentials` using local config.

To get the file-based queue system working, your local config will need something like this:

```
---
Name: jobrunner
After:
  - queuedjobs
---
SilverStripe\Core\Injector\Injector:
  QueueHandler:
    class: Symbiote\SqsJobQueue\Service\SqsQueueHandler
    properties:
      sqsService: '%$Symbiote\SqsJobQueue\Service\SqsService'
  Symbiote\SqsJobQueue\Service\SqsService:
    properties:
      queueName: '%sqs_jobqueue_name%'
---
Name: sqs_location
After: '#sqs_config'
---
SilverStripe\Core\Injector\Injector:
  Symbiote\SqsJobQueue\Service\FileBasedSqsQueue:
    properties:
      queuePath: /var/www/html/mysite/fake-sqs-queues

```

The important part is making sure `/var/www/html/mysite/fake-sqs-queues` is writable since that's where your queued jobs will be written to.

#### Docker Testing

[](#docker-testing)

The simplest way to test this once all your configs are in place is to:

- Queue up a job (e.g. using the  module)
- Ensure a file is written to `/var/www/html/mysite/fake-sqs-queues`
- Run `docker logs sqsrunner` to see whether it picked up the job
- View the queued jobs admin to ensure the job was completed

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 91.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~162 days

Recently: every ~261 days

Total

19

Last Release

607d ago

Major Versions

1.0.2 → 2.0.02017-06-30

2.2.3 → 3.2.02020-12-09

2.2.5 → 3.3.32023-10-12

3.3.4 → 4.0.02024-09-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/25cb1c56a7ab949d1e6b28a2a04862ce1cffe1799a291e1797f8dfd33cd83716?d=identicon)[nyeholt](/maintainers/nyeholt)

---

Top Contributors

[![nyeholt](https://avatars.githubusercontent.com/u/161730?v=4)](https://github.com/nyeholt "nyeholt (22 commits)")[![nglasl](https://avatars.githubusercontent.com/u/3703500?v=4)](https://github.com/nglasl "nglasl (1 commits)")[![xini](https://avatars.githubusercontent.com/u/1152403?v=4)](https://github.com/xini "xini (1 commits)")

---

Tags

awssilverstripesqssymbiotequeuedjobsthrive

### Embed Badge

![Health badge](/badges/symbiote-silverstripe-sqs-jobqueue/health.svg)

```
[![Health](https://phpackages.com/badges/symbiote-silverstripe-sqs-jobqueue/health.svg)](https://phpackages.com/packages/symbiote-silverstripe-sqs-jobqueue)
```

###  Alternatives

[dusterio/laravel-aws-worker

Run Laravel (or Lumen) tasks and queue listeners inside of AWS Elastic Beanstalk workers

3105.7M](/packages/dusterio-laravel-aws-worker)[enqueue/sqs

Message Queue Amazon SQS Transport

376.3M14](/packages/enqueue-sqs)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
