nervous-systems / fink-nottle

Asynchronous Clojure/Clojurescript client for Amazon's SNS & SQS services
The Unlicense
48 stars 4 forks source link

SNS TTL value? #15

Open luposlip opened 8 years ago

luposlip commented 8 years ago

Hi there!

Thanks for a great library. According to SNS API doc. it's possible to set a TTL (Time To Live) value of the messages (push notifications) sent via SNS.

This is done via MessageAttributes, which looks to be merely a map.

By searching your repo I can't seem to find anywhere to add this attribute value. Can you please let me know if I have overseen something, or if fink-nottle doesn't (yet) support TTL values?

Best regards, Henrik

luposlip commented 8 years ago

Just found this: https://github.com/nervous-systems/fink-nottle/issues/8

Can the TTL be set to 1 day using the following snippet?

(fink-nottle.sns/publish-endpoint! creds endpoint-arn message
 {:attrs {"AWS.SNS.MOBILE.GCM.TTL" "86400"}})
moea commented 8 years ago

Yeah, that looks correct to me. It could be more convenient, but the example you gave ought to work. fink-nottle will turn that into {:attrs {"AWS.SNS.MOBILE.GCM.TTL" [:string "84600"]}}, which eulalie turns into the query string:

MessageAttributes.Member.1.Name=AWS.SNS.MOBILE.GCM.TTL&MessageAttributes.Member.1.Value.DataType=String&MessageAttributes.Member.1.Value.StringValue=84600

Which appears correct. Please let me know how that works out.

luposlip commented 8 years ago

Thanks for your feedback. I'll give it a go!