Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sns] added possibility to define already existing topics (prevent create topic call) #1022 #1147

Merged
merged 7 commits into from
Mar 18, 2021

Conversation

paramonov
Copy link

No description provided.

{
$this->client = $client;
$this->config = $config;

$this->topicArns = [];
$this->topicArns = $topicArns;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

topicArns property format is

topic_name => arn 

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, refactored

@@ -71,7 +72,7 @@ public function __construct($config = 'sns:')
*/
public function createContext(): Context
{
return new SnsContext($this->establishConnection(), $this->config);
return new SnsContext($this->establishConnection(), $this->config, $this->config['topic_arns']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you pass topc_arns as separate arg? They are already there in config which is passed as second arg

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed third arg

@@ -59,6 +60,9 @@ public function __construct($config = 'sns:')

unset($config['dsn']);
}
if (\array_key_exists('topic_arns', $config) && \is_string($config['topic_arns'])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at this stage it has to be assoc array already. The string parsing should happen if dsn is passed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed, not needed when using dsn parsing

];

yield [
['dsn' => 'sns:?topic_arns=topic1|arn:aws:sns:us-east-1:123456789012:topic1;topic2|arn:aws:sns:us-west-2:123456789012:topic2'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about passing arns as

topic_arns[topic1]=arn:aws:sns:us-east-1:123456789012&topic_arns[topic2]=arn:aws:sns:us-west-2:123456789012:topic2

that way the standard query parsing function does the job

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, replaced

@makasim makasim merged commit 7d3da26 into php-enqueue:master Mar 18, 2021
@makasim
Copy link
Member

makasim commented Mar 18, 2021

fixes #1022

@makasim makasim mentioned this pull request Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants