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

[aws-sns] SNS FIFO #11127

Closed
sawasawasawa opened this issue Oct 26, 2020 · 8 comments · Fixed by #11588
Closed

[aws-sns] SNS FIFO #11127

sawasawasawa opened this issue Oct 26, 2020 · 8 comments · Fixed by #11588
Assignees
Labels
@aws-cdk/aws-sns Related to Amazon Simple Notification Service effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on. p2

Comments

@sawasawasawa
Copy link

When can we expect sns cdk to support FIFO? https://docs.aws.amazon.com/cdk/api/latest/docs/aws-sns-readme.html


This is a 📕 documentation issue

@sawasawasawa sawasawasawa added documentation This is a problem with documentation. feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Oct 26, 2020
@github-actions github-actions bot added the @aws-cdk/aws-sns Related to Amazon Simple Notification Service label Oct 26, 2020
@NetaNir NetaNir closed this as completed Oct 28, 2020
@aws aws deleted a comment from github-actions bot Oct 28, 2020
@NetaNir NetaNir reopened this Oct 28, 2020
@NetaNir NetaNir added effort/small Small work item – less than a day of effort and removed documentation This is a problem with documentation. needs-triage This issue or PR still needs to be triaged. labels Oct 28, 2020
@ran-isenberg
Copy link

+1, really waiting for this.

@skyrpex
Copy link
Contributor

skyrpex commented Nov 2, 2020

Is it just a documentation issue? Does that mean that I can build SNS FIFO already?

@frjtrifork
Copy link

frjtrifork commented Nov 3, 2020

Since FIFO Topic support has been added to Cloudformation already, and aws-sns already contain a Topic construct - you can use the cdk escape hatch approach and add raw property overrides to create an SNS fifo topic.

That way you can have FIFO Topics created from CDK now, without waiting for a cdk release that includes it directly.

I made a small helper method like this (typescript) - note we have a naming convention in our team so FIFO topics and queues end with .fifo - I'm not completely sure if that is actually needed:

public static createFifoTopic(stack: Stack, name: string) {
    if (!name.endsWith('.fifo')) name = name + '.fifo';
    const topic = new sns.Topic(stack, name, {
      topicName: name
    });
    
    const cfnTopic = topic.node.defaultChild as CfnTopic
    cfnTopic.addPropertyOverride("FifoTopic", true);
    cfnTopic.addPropertyOverride("ContentBasedDeduplication", false);
    return topic;
}

Which called like this
SnsComponent.createFifoTopic(stack, 'foo')

Will result in an SNS::Topic template like this:

 "foofifoCAF914F4": {
      "Type": "AWS::SNS::Topic",
      "Properties": {
        "ContentBasedDeduplication": false,
        "TopicName": "foo.fifo",
        "FifoTopic": true
      },
      "Metadata": {
        "aws:cdk:path": "fooservice-stack/foo.fifo/Resource"
      }
    },

See - https://docs.aws.amazon.com/sns/latest/dg/fifo-topic-code-examples.html
and - https://docs.aws.amazon.com/cdk/latest/guide/cfn_layer.html#cfn_layer_raw

@skyrpex
Copy link
Contributor

skyrpex commented Nov 3, 2020

@frjtrifork thank you, that was very helpful!

@gergan
Copy link

gergan commented Nov 11, 2020

It seems there is a bug in CloudFormation, the TopicName with the .fifo ending should be created correctly from CloudFormation, but this does not happen currently. That's why @frjtrifork uses fix name with .fifo ending probably?

@rrhodes
Copy link
Contributor

rrhodes commented Nov 19, 2020

Hello, I'm opening a PR now to support content-based deduplication and FIFO topics using the Topic CDK construct.

rrhodes pushed a commit to rrhodes/aws-cdk that referenced this issue Nov 19, 2020
@SomayaB SomayaB added the in-progress This issue is being actively worked on. label Nov 20, 2020
@gregglazewskiecl
Copy link

Any idea when would it be released after merging PR? This is a super needed feature.

@mergify mergify bot closed this as completed in #11588 Jan 4, 2021
mergify bot pushed a commit that referenced this issue Jan 4, 2021
…#11588)

Add support for FIFO and content-based deduplication in SNS topics.

Closes #11127 
----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

github-actions bot commented Jan 4, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

flochaz pushed a commit to flochaz/aws-cdk that referenced this issue Jan 5, 2021
 (aws#11588)

Add support for FIFO and content-based deduplication in SNS topics.

Closes aws#11127 
----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-sns Related to Amazon Simple Notification Service effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants