File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,11 @@ public function unsubscribe(array $args): Result
6060 return $ this ->callApi ('unsubscribe ' , $ args );
6161 }
6262
63+ public function setSubscriptionAttributes (array $ args ): Result
64+ {
65+ return $ this ->callApi ('setSubscriptionAttributes ' , $ args );
66+ }
67+
6368 public function listSubscriptionsByTopic (array $ args ): Result
6469 {
6570 return $ this ->callApi ('ListSubscriptionsByTopic ' , $ args );
Original file line number Diff line number Diff line change @@ -145,6 +145,16 @@ public function getSubscriptions(SnsDestination $destination): array
145145 return $ subscriptions ;
146146 }
147147
148+ public function setSubscriptionAttributes (SnsSubscribe $ subscribe ): void
149+ {
150+ foreach ($ this ->getSubscriptions ($ subscribe ->getTopic ()) as $ subscription ) {
151+ $ this ->client ->setSubscriptionAttributes (array_merge (
152+ $ subscribe ->getAttributes (),
153+ ['SubscriptionArn ' => $ subscription ['SubscriptionArn ' ]],
154+ ));
155+ }
156+ }
157+
148158 public function getTopicArn (SnsDestination $ destination ): string
149159 {
150160 if (false == array_key_exists ($ destination ->getTopicName (), $ this ->topicArns )) {
Original file line number Diff line number Diff line change @@ -173,6 +173,17 @@ public function close(): void
173173 $ this ->getSqsContext ()->close ();
174174 }
175175
176+ public function setSubscriptionAttributes (SnsQsTopic $ topic , SnsQsQueue $ queue , array $ attributes ): void
177+ {
178+ $ this ->getSnsContext ()->setSubscriptionAttributes (new SnsSubscribe (
179+ $ topic ,
180+ $ this ->getSqsContext ()->getQueueArn ($ queue ),
181+ SnsSubscribe::PROTOCOL_SQS ,
182+ false ,
183+ $ attributes ,
184+ ));
185+ }
186+
176187 private function getSnsContext (): SnsContext
177188 {
178189 if (null === $ this ->snsContext ) {
You can’t perform that action at this time.
0 commit comments