in cdk/lib/wires-feeds.ts [37:72]
function createTopicQueue(scope: GuStack, topicType: string) {
const topic = new Topic(scope, `${topicType}-topic`, {
enforceSSL: true,
});
topic.applyRemovalPolicy(RemovalPolicy.RETAIN_ON_UPDATE_OR_DELETE);
topic.grantPublish(new ArnPrincipal(user.userArn));
const queueName = `${topicType}-queue`;
const visibilityTimeout = Duration.minutes(5);
const deadLetterQueue = new Queue(
scope,
`${queueName}DeadLetterQueue-${props.stage}`,
{ visibilityTimeout },
);
const queue = new Queue(scope, queueName, {
enforceSSL: true,
retentionPeriod: Duration.days(14),
// We are using this queue in conjunction with a lambda SqsEventSource
// visibilityTimeout is set by default to 5 minutes to ensure that the lambda has
// enough time to process the message before it becomes visible again.
visibilityTimeout: Duration.minutes(5),
deadLetterQueue: {
queue: deadLetterQueue,
maxReceiveCount: 3,
},
removalPolicy: RemovalPolicy.RETAIN_ON_UPDATE_OR_DELETE,
});
topic.addSubscription(
new SqsSubscription(queue, { rawMessageDelivery: true }),
);
return queue;
}