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

bug: Support async sns/sqs message publishing v9 #3269

Merged
merged 6 commits into from
Aug 28, 2024

Conversation

jtsalva
Copy link
Contributor

@jtsalva jtsalva commented Aug 20, 2024

Addresses #3242

@@ -45,16 +45,16 @@ public AWSMessagingGateway(AWSMessagingGatewayConnection awsConnection)
_awsClientFactory = new AWSClientFactory(awsConnection);
}

protected string EnsureTopic(RoutingKey topic, SnsAttributes attributes, TopicFindBy topicFindBy, OnMissingChannel makeTopic)
protected async Task<string> EnsureTopic(RoutingKey topic, SnsAttributes attributes, TopicFindBy topicFindBy, OnMissingChannel makeTopic)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is a v9 PR, you need to be careful about breaking changes. Changing the signature of a non-private method on a non-private class is a breaking change for consumers updating their packages - they'd now have a bunch of tasks flying around in their code they're not going anything with.

Breaking changes should be reserved for major version upgrades, so v10 would be an OK place to make changes like this. That said, it would need to be part of a broader conversation around the conventions when it comes to supporting async methods. I would suggest we keep it as the addition of the async publish methods, and leave the auxiliary methods as they are now.

@@ -42,7 +43,7 @@ public SqsMessagePublisher(string topicArn, AmazonSimpleNotificationServiceClien
_client = client;
}

public string Publish(Message message)
public async Task<string> Publish(Message message)
Copy link
Contributor

Choose a reason for hiding this comment

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

As with the comment above about breaking changes, since this is a public method on a public class, we should be adding a new method for the async version, even if the sync version is just calling GetAwaiter().GetResult() on the new method.

@jtsalva jtsalva changed the title Support async sns/sqs message publishing Support async sns/sqs message publishing v9 Aug 21, 2024
@@ -61,7 +61,7 @@ public SqsMessageProducerSendTests()
public async Task When_posting_a_message_via_the_producer()
{
//arrange
_messageProducer.Send(_message);
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably have one version of the test that calls the sync method, and one version that calls the async method.

@jtsalva jtsalva marked this pull request as ready for review August 23, 2024 12:14
@jtsalva jtsalva changed the title Support async sns/sqs message publishing v9 bug: Support async sns/sqs message publishing v9 Aug 23, 2024
@iancooper iancooper merged commit d3558a1 into BrighterCommand:release/9X Aug 28, 2024
16 of 17 checks passed
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.

3 participants