Curious, any plan to allow SST Topic construct to ...
# sst
s
Curious, any plan to allow SST Topic construct to also accept subscriptions props like
filterPolicy
? Also along with it, support to add other kind of subscribers like SQS... I was hoping to migrate serverless framework pub/sub service with several filter policies to SST.
f
Opened two issues: • support subscription filter https://github.com/serverless-stack/serverless-stack/issues/151 • support queue subscribers for Topic https://github.com/serverless-stack/serverless-stack/issues/92
Btw, is the same Topic subscribed by both Lambda and SQS in your case?
s
Sweeet. thank you the for opened issues. Not both. My existing Topic is a fan-out to multiple lambdas only, each with filter policy. The SQS subscriber was going to be new Topic that I'm planning to implement and they would only be just SQS subscribers.
f
Got it! As a workaround for now, you can do something like this in native CDK code:
Copy code
import * as sns from "@aws-cdk/aws-sns";
import * as snsSub from '@aws-cdk/aws-sns-subscriptions';

const topic = new sns.Topic(..)
const queue = new sst.Queue(..)
topic.addSubscription(new snsSub.SqsSubscription(queue.sqsQueue));
Have you tried this?
s
Yes, that's my work around for now. I love that we can still have escape hatch to use the native cdk.
f
Ah got it! That makes sense. I will keep you posted when I get to the issues.
s
Awesome. thank you. really, no rush.
f
@Sione Added support for subscription filter for
sst.Topic
in v0.9.12 To update:
Copy code
$ npm install --save --save-exact @serverless-stack/cli@0.9.12 @serverless-stack/resources@0.9.12
And here’s an example on how to set subscription filter https://docs.serverless-stack.com/constructs/Topic#configuring-a-subscriber
s
Awesome. I'll check it out. you guys rocks. thank you