Skip to content

Commit 738fb1b

Browse files
committed
[sqs] Do not use deprecated classes.
1 parent 15a75e1 commit 738fb1b

16 files changed

+97
-97
lines changed

pkg/sqs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Total Downloads](https://poser.pugx.org/enqueue/sqs/d/total.png)](https://packagist.org/packages/enqueue/sqs)
66
[![Latest Stable Version](https://poser.pugx.org/enqueue/sqs/version.png)](https://packagist.org/packages/enqueue/sqs)
77

8-
This is an implementation of PSR specification. It allows you to send and consume message through Amazon SQS library.
8+
This is an implementation of Queue Interop specification. It allows you to send and consume message through Amazon SQS library.
99

1010
## Resources
1111

pkg/sqs/SqsConnectionFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66

77
use Aws\Sqs\SqsClient;
88
use Enqueue\Dsn\Dsn;
9-
use Interop\Queue\PsrConnectionFactory;
10-
use Interop\Queue\PsrContext;
9+
use Interop\Queue\ConnectionFactory;
10+
use Interop\Queue\Context;
1111

12-
class SqsConnectionFactory implements PsrConnectionFactory
12+
class SqsConnectionFactory implements ConnectionFactory
1313
{
1414
/**
1515
* @var array
@@ -69,7 +69,7 @@ public function __construct($config = 'sqs:')
6969
/**
7070
* @return SqsContext
7171
*/
72-
public function createContext(): PsrContext
72+
public function createContext(): Context
7373
{
7474
if ($this->config['lazy']) {
7575
return new SqsContext(function () {

pkg/sqs/SqsConsumer.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
namespace Enqueue\Sqs;
66

7-
use Interop\Queue\InvalidMessageException;
8-
use Interop\Queue\PsrConsumer;
9-
use Interop\Queue\PsrMessage;
10-
use Interop\Queue\PsrQueue;
7+
use Interop\Queue\Consumer;
8+
use Interop\Queue\Exception\InvalidMessageException;
9+
use Interop\Queue\Message;
10+
use Interop\Queue\Queue;
1111

12-
class SqsConsumer implements PsrConsumer
12+
class SqsConsumer implements Consumer
1313
{
1414
/**
1515
* @var SqsDestination
@@ -75,15 +75,15 @@ public function setMaxNumberOfMessages(int $maxNumberOfMessages): void
7575
/**
7676
* @return SqsDestination
7777
*/
78-
public function getQueue(): PsrQueue
78+
public function getQueue(): Queue
7979
{
8080
return $this->queue;
8181
}
8282

8383
/**
8484
* @return SqsMessage
8585
*/
86-
public function receive(int $timeout = 0): ?PsrMessage
86+
public function receive(int $timeout = 0): ?Message
8787
{
8888
$maxLongPollingTime = 20; // 20 is max allowed long polling value
8989

@@ -107,15 +107,15 @@ public function receive(int $timeout = 0): ?PsrMessage
107107
/**
108108
* @return SqsMessage
109109
*/
110-
public function receiveNoWait(): ?PsrMessage
110+
public function receiveNoWait(): ?Message
111111
{
112112
return $this->receiveMessage(0);
113113
}
114114

115115
/**
116116
* @param SqsMessage $message
117117
*/
118-
public function acknowledge(PsrMessage $message): void
118+
public function acknowledge(Message $message): void
119119
{
120120
InvalidMessageException::assertMessageInstanceOf($message, SqsMessage::class);
121121

@@ -128,7 +128,7 @@ public function acknowledge(PsrMessage $message): void
128128
/**
129129
* @param SqsMessage $message
130130
*/
131-
public function reject(PsrMessage $message, bool $requeue = false): void
131+
public function reject(Message $message, bool $requeue = false): void
132132
{
133133
InvalidMessageException::assertMessageInstanceOf($message, SqsMessage::class);
134134

pkg/sqs/SqsContext.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
namespace Enqueue\Sqs;
66

77
use Aws\Sqs\SqsClient;
8-
use Interop\Queue\InvalidDestinationException;
9-
use Interop\Queue\PsrConsumer;
10-
use Interop\Queue\PsrContext;
11-
use Interop\Queue\PsrDestination;
12-
use Interop\Queue\PsrMessage;
13-
use Interop\Queue\PsrProducer;
14-
use Interop\Queue\PsrQueue;
15-
use Interop\Queue\PsrSubscriptionConsumer;
16-
use Interop\Queue\PsrTopic;
17-
use Interop\Queue\SubscriptionConsumerNotSupportedException;
18-
use Interop\Queue\TemporaryQueueNotSupportedException;
19-
20-
class SqsContext implements PsrContext
8+
use Interop\Queue\Consumer;
9+
use Interop\Queue\Context;
10+
use Interop\Queue\Destination;
11+
use Interop\Queue\Exception\InvalidDestinationException;
12+
use Interop\Queue\Exception\SubscriptionConsumerNotSupportedException;
13+
use Interop\Queue\Exception\TemporaryQueueNotSupportedException;
14+
use Interop\Queue\Message;
15+
use Interop\Queue\Producer;
16+
use Interop\Queue\Queue;
17+
use Interop\Queue\SubscriptionConsumer;
18+
use Interop\Queue\Topic;
19+
20+
class SqsContext implements Context
2121
{
2222
/**
2323
* @var SqsClient
@@ -57,36 +57,36 @@ public function __construct($client)
5757
/**
5858
* @return SqsMessage
5959
*/
60-
public function createMessage(string $body = '', array $properties = [], array $headers = []): PsrMessage
60+
public function createMessage(string $body = '', array $properties = [], array $headers = []): Message
6161
{
6262
return new SqsMessage($body, $properties, $headers);
6363
}
6464

6565
/**
6666
* @return SqsDestination
6767
*/
68-
public function createTopic(string $topicName): PsrTopic
68+
public function createTopic(string $topicName): Topic
6969
{
7070
return new SqsDestination($topicName);
7171
}
7272

7373
/**
7474
* @return SqsDestination
7575
*/
76-
public function createQueue(string $queueName): PsrQueue
76+
public function createQueue(string $queueName): Queue
7777
{
7878
return new SqsDestination($queueName);
7979
}
8080

81-
public function createTemporaryQueue(): PsrQueue
81+
public function createTemporaryQueue(): Queue
8282
{
8383
throw TemporaryQueueNotSupportedException::providerDoestNotSupportIt();
8484
}
8585

8686
/**
8787
* @return SqsProducer
8888
*/
89-
public function createProducer(): PsrProducer
89+
public function createProducer(): Producer
9090
{
9191
return new SqsProducer($this);
9292
}
@@ -96,7 +96,7 @@ public function createProducer(): PsrProducer
9696
*
9797
* @return SqsConsumer
9898
*/
99-
public function createConsumer(PsrDestination $destination): PsrConsumer
99+
public function createConsumer(Destination $destination): Consumer
100100
{
101101
InvalidDestinationException::assertDestinationInstanceOf($destination, SqsDestination::class);
102102

@@ -110,7 +110,7 @@ public function close(): void
110110
/**
111111
* @param SqsDestination $queue
112112
*/
113-
public function purgeQueue(PsrQueue $queue): void
113+
public function purgeQueue(Queue $queue): void
114114
{
115115
InvalidDestinationException::assertDestinationInstanceOf($queue, SqsDestination::class);
116116

@@ -119,7 +119,7 @@ public function purgeQueue(PsrQueue $queue): void
119119
]);
120120
}
121121

122-
public function createSubscriptionConsumer(): PsrSubscriptionConsumer
122+
public function createSubscriptionConsumer(): SubscriptionConsumer
123123
{
124124
throw SubscriptionConsumerNotSupportedException::providerDoestNotSupportIt();
125125
}

pkg/sqs/SqsDestination.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
namespace Enqueue\Sqs;
66

7-
use Interop\Queue\PsrQueue;
8-
use Interop\Queue\PsrTopic;
7+
use Interop\Queue\Queue;
8+
use Interop\Queue\Topic;
99

10-
class SqsDestination implements PsrTopic, PsrQueue
10+
class SqsDestination implements Topic, Queue
1111
{
1212
/**
1313
* @var string

pkg/sqs/SqsMessage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
namespace Enqueue\Sqs;
66

7-
use Interop\Queue\PsrMessage;
7+
use Interop\Queue\Message;
88

9-
class SqsMessage implements PsrMessage
9+
class SqsMessage implements Message
1010
{
1111
/**
1212
* @var string

pkg/sqs/SqsProducer.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
namespace Enqueue\Sqs;
66

7-
use Interop\Queue\InvalidDestinationException;
8-
use Interop\Queue\InvalidMessageException;
9-
use Interop\Queue\PriorityNotSupportedException;
10-
use Interop\Queue\PsrDestination;
11-
use Interop\Queue\PsrMessage;
12-
use Interop\Queue\PsrProducer;
13-
use Interop\Queue\TimeToLiveNotSupportedException;
14-
15-
class SqsProducer implements PsrProducer
7+
use Interop\Queue\Destination;
8+
use Interop\Queue\Exception\InvalidDestinationException;
9+
use Interop\Queue\Exception\InvalidMessageException;
10+
use Interop\Queue\Exception\PriorityNotSupportedException;
11+
use Interop\Queue\Exception\TimeToLiveNotSupportedException;
12+
use Interop\Queue\Message;
13+
use Interop\Queue\Producer;
14+
15+
class SqsProducer implements Producer
1616
{
1717
/**
1818
* @var int|null
@@ -33,7 +33,7 @@ public function __construct(SqsContext $context)
3333
* @param SqsDestination $destination
3434
* @param SqsMessage $message
3535
*/
36-
public function send(PsrDestination $destination, PsrMessage $message): void
36+
public function send(Destination $destination, Message $message): void
3737
{
3838
InvalidDestinationException::assertDestinationInstanceOf($destination, SqsDestination::class);
3939
InvalidMessageException::assertMessageInstanceOf($message, SqsMessage::class);
@@ -80,7 +80,7 @@ public function send(PsrDestination $destination, PsrMessage $message): void
8080
/**
8181
* @return SqsProducer
8282
*/
83-
public function setDeliveryDelay(int $deliveryDelay = null): PsrProducer
83+
public function setDeliveryDelay(int $deliveryDelay = null): Producer
8484
{
8585
$this->deliveryDelay = $deliveryDelay;
8686

@@ -95,7 +95,7 @@ public function getDeliveryDelay(): ?int
9595
/**
9696
* @return SqsProducer
9797
*/
98-
public function setPriority(int $priority = null): PsrProducer
98+
public function setPriority(int $priority = null): Producer
9999
{
100100
if (null === $priority) {
101101
return $this;
@@ -112,7 +112,7 @@ public function getPriority(): ?int
112112
/**
113113
* @return SqsProducer
114114
*/
115-
public function setTimeToLive(int $timeToLive = null): PsrProducer
115+
public function setTimeToLive(int $timeToLive = null): Producer
116116
{
117117
if (null === $timeToLive) {
118118
return $this;

pkg/sqs/Tests/Functional/SqsConsumptionUseCasesTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
use Enqueue\Sqs\SqsContext;
1212
use Enqueue\Test\RetryTrait;
1313
use Enqueue\Test\SqsExtension;
14-
use Interop\Queue\PsrContext;
15-
use Interop\Queue\PsrMessage;
16-
use Interop\Queue\PsrProcessor;
14+
use Interop\Queue\Context;
15+
use Interop\Queue\Message;
16+
use Interop\Queue\Processor;
1717
use PHPUnit\Framework\TestCase;
1818

1919
class SqsConsumptionUseCasesTest extends TestCase
@@ -65,7 +65,7 @@ public function testConsumeOneMessageAndExit()
6565

6666
$queueConsumer->consume();
6767

68-
$this->assertInstanceOf(PsrMessage::class, $processor->lastProcessedMessage);
68+
$this->assertInstanceOf(Message::class, $processor->lastProcessedMessage);
6969
$this->assertEquals(__METHOD__, $processor->lastProcessedMessage->getBody());
7070
}
7171

@@ -98,22 +98,22 @@ public function testConsumeOneMessageAndSendReplyExit()
9898
$queueConsumer->bind($replyQueue, $replyProcessor);
9999
$queueConsumer->consume();
100100

101-
$this->assertInstanceOf(PsrMessage::class, $processor->lastProcessedMessage);
101+
$this->assertInstanceOf(Message::class, $processor->lastProcessedMessage);
102102
$this->assertEquals(__METHOD__, $processor->lastProcessedMessage->getBody());
103103

104-
$this->assertInstanceOf(PsrMessage::class, $replyProcessor->lastProcessedMessage);
104+
$this->assertInstanceOf(Message::class, $replyProcessor->lastProcessedMessage);
105105
$this->assertEquals(__METHOD__.'.reply', $replyProcessor->lastProcessedMessage->getBody());
106106
}
107107
}
108108

109-
class StubProcessor implements PsrProcessor
109+
class StubProcessor implements Processor
110110
{
111111
public $result = self::ACK;
112112

113-
/** @var PsrMessage */
113+
/** @var Message */
114114
public $lastProcessedMessage;
115115

116-
public function process(PsrMessage $message, PsrContext $context)
116+
public function process(Message $message, Context $context)
117117
{
118118
$this->lastProcessedMessage = $message;
119119

pkg/sqs/Tests/Spec/SqsSendAndReceiveDelayedMessageFromQueueTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Enqueue\Sqs\SqsDestination;
77
use Enqueue\Test\RetryTrait;
88
use Enqueue\Test\SqsExtension;
9-
use Interop\Queue\PsrContext;
9+
use Interop\Queue\Context;
1010
use Interop\Queue\Spec\SendAndReceiveDelayedMessageFromQueueSpec;
1111

1212
/**
@@ -50,7 +50,7 @@ protected function createContext()
5050
*
5151
* @param SqsContext $context
5252
*/
53-
protected function createQueue(PsrContext $context, $queueName)
53+
protected function createQueue(Context $context, $queueName)
5454
{
5555
$queueName = $queueName.time();
5656

pkg/sqs/Tests/Spec/SqsSendToAndReceiveFromQueueTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Enqueue\Sqs\SqsContext;
66
use Enqueue\Sqs\SqsDestination;
77
use Enqueue\Test\SqsExtension;
8-
use Interop\Queue\PsrContext;
8+
use Interop\Queue\Context;
99
use Interop\Queue\Spec\SendToAndReceiveFromQueueSpec;
1010

1111
/**
@@ -47,7 +47,7 @@ protected function createContext()
4747
*
4848
* @param SqsContext $context
4949
*/
50-
protected function createQueue(PsrContext $context, $queueName)
50+
protected function createQueue(Context $context, $queueName)
5151
{
5252
$queueName = $queueName.time();
5353

pkg/sqs/Tests/Spec/SqsSendToAndReceiveFromTopicTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Enqueue\Sqs\SqsDestination;
77
use Enqueue\Test\RetryTrait;
88
use Enqueue\Test\SqsExtension;
9-
use Interop\Queue\PsrContext;
9+
use Interop\Queue\Context;
1010
use Interop\Queue\Spec\SendToAndReceiveFromTopicSpec;
1111

1212
/**
@@ -50,7 +50,7 @@ protected function createContext()
5050
*
5151
* @param SqsContext $context
5252
*/
53-
protected function createTopic(PsrContext $context, $topicName)
53+
protected function createTopic(Context $context, $topicName)
5454
{
5555
$topicName = $topicName.time();
5656

0 commit comments

Comments
 (0)