@@ -118,11 +118,12 @@ export abstract class TopicBase extends cdk.Construct implements ITopic {
118
118
/**
119
119
* Subscribe some endpoint to this topic
120
120
*/
121
- public subscribe ( name : string , endpoint : string , protocol : SubscriptionProtocol ) : Subscription {
121
+ public subscribe ( name : string , endpoint : string , protocol : SubscriptionProtocol , rawMessageDelivery ?: boolean ) : Subscription {
122
122
return new Subscription ( this , name , {
123
123
topic : this ,
124
124
endpoint,
125
- protocol
125
+ protocol,
126
+ rawMessageDelivery,
126
127
} ) ;
127
128
}
128
129
@@ -134,8 +135,9 @@ export abstract class TopicBase extends cdk.Construct implements ITopic {
134
135
*
135
136
* @param name The subscription name
136
137
* @param queue The target queue
138
+ * @param rawMessageDelivery Enable raw message delivery
137
139
*/
138
- public subscribeQueue ( queue : sqs . IQueue ) : Subscription {
140
+ public subscribeQueue ( queue : sqs . IQueue , rawMessageDelivery ?: boolean ) : Subscription {
139
141
if ( ! cdk . Construct . isConstruct ( queue ) ) {
140
142
throw new Error ( `The supplied Queue object must be an instance of Construct` ) ;
141
143
}
@@ -151,7 +153,8 @@ export abstract class TopicBase extends cdk.Construct implements ITopic {
151
153
const sub = new Subscription ( queue , subscriptionName , {
152
154
topic : this ,
153
155
endpoint : queue . queueArn ,
154
- protocol : SubscriptionProtocol . Sqs
156
+ protocol : SubscriptionProtocol . Sqs ,
157
+ rawMessageDelivery,
155
158
} ) ;
156
159
157
160
// add a statement to the queue resource policy which allows this topic
@@ -190,7 +193,7 @@ export abstract class TopicBase extends cdk.Construct implements ITopic {
190
193
const sub = new Subscription ( lambdaFunction , subscriptionName , {
191
194
topic : this ,
192
195
endpoint : lambdaFunction . functionArn ,
193
- protocol : SubscriptionProtocol . Lambda
196
+ protocol : SubscriptionProtocol . Lambda ,
194
197
} ) ;
195
198
196
199
lambdaFunction . addPermission ( this . node . id , {
@@ -206,7 +209,7 @@ export abstract class TopicBase extends cdk.Construct implements ITopic {
206
209
*
207
210
* @param name A name for the subscription
208
211
* @param emailAddress The email address to use.
209
- * @param jsonFormat True if the email content should be in JSON format (default is false) .
212
+ * @param options Options for the email delivery format.
210
213
*/
211
214
public subscribeEmail ( name : string , emailAddress : string , options ?: EmailSubscriptionOptions ) : Subscription {
212
215
const protocol = ( options && options . json ? SubscriptionProtocol . EmailJson : SubscriptionProtocol . Email ) ;
@@ -223,8 +226,9 @@ export abstract class TopicBase extends cdk.Construct implements ITopic {
223
226
*
224
227
* @param name A name for the subscription
225
228
* @param url The URL to invoke
229
+ * @param rawMessageDelivery Enable raw message delivery
226
230
*/
227
- public subscribeUrl ( name : string , url : string ) : Subscription {
231
+ public subscribeUrl ( name : string , url : string , rawMessageDelivery ?: boolean ) : Subscription {
228
232
if ( ! url . startsWith ( 'http://' ) && ! url . startsWith ( 'https://' ) ) {
229
233
throw new Error ( 'URL must start with either http:// or https://' ) ;
230
234
}
@@ -234,7 +238,8 @@ export abstract class TopicBase extends cdk.Construct implements ITopic {
234
238
return new Subscription ( this , name , {
235
239
topic : this ,
236
240
endpoint : url ,
237
- protocol
241
+ protocol,
242
+ rawMessageDelivery,
238
243
} ) ;
239
244
}
240
245
@@ -353,5 +358,5 @@ export interface EmailSubscriptionOptions {
353
358
*
354
359
* @default Message text (false)
355
360
*/
356
- json ?: boolean
361
+ json ?: boolean ;
357
362
}
0 commit comments