SQS implementation as an adapter for spryker/queue
composer req valantic-spryker-eco/sqs
config/Shared/config_default.php
$config[KernelConstants::CORE_NAMESPACES] = [
...
'ValanticSpryker',
];
$config[SqsConstants::SQS_BASE_URL] = 'http://elasticmq:9324';
$config[SqsConstants::SQS_QUEUE_PATH_PREFIX] = 'queue/';
\Pyz\Zed\Queue\QueueConfig
...
/**
* @var string
*/
public const AWS_SQS = 'aws-sqs';
...
/**
* @return array
*/
protected function getMessageCheckOptions(): array
{
return [
QueueConstants::QUEUE_WORKER_MESSAGE_CHECK_OPTION => [
...
static::AWS_SQS => $this->getAwsSqsQueueMessageCheckOptions(),
];
}
...
/**
* @return \Generated\Shared\Transfer\AwsSqsConsumerOptionTransfer
*/
protected function getAwsSqsQueueMessageCheckOptions(): AwsSqsConsumerOptionTransfer
{
$queueOptionTransfer = new AwsSqsConsumerOptionTransfer();
$queueOptionTransfer->setCheckMessageCount(true);
return $queueOptionTransfer;
}
...
\Pyz\Zed\Console\ConsoleDependencyProvider
/**
* @param \Spryker\Zed\Kernel\Container $container
*
* @return \Symfony\Component\Console\Command\Command[]
*/
protected function getConsoleCommands(Container $container): array
{
$commands = [
...
new SqsCreateQueuesConsole(),
new SqsPurgeAllQueuesConsole(),
new SqsRemoveQueuesConsole(),
];
In many cases when you operate SQS next to RabbitMq, it will make sense to also extend the Queue module to separate RabbitMq workers from SQS workers. To achieve this you should extend QueueDependencyProvider and QueueBusinessFactory to create Task and Worker for RabbitMq and SQS independently.