How the heck does the SNS subscription actually fi...
# adobe
a
How the heck does the SNS subscription actually fire when a topic is published? Reading this: https://helpx.adobe.com/coldfusion/using/integrate-coldfusion-amazon-sns.html#Subscribetoatopic I can see you can subscribe, but what does CF actually do when a 3rd party publishes to the subscribed topic?
Ah - it's just a pub/sub and the subscriber asks the publisher to "call this endpoint when you have any news"
Was looking at using it to distribute work across a cluster, but that wain't going work then unless each cluster instance has it's own unique URL (which as it's behind a load balancer it doesn't)
s
SQS is a little more sophisticated if you want to try that. We use SNS just to handle SES email bounces and spam reports
a
Thanks - was looking at "Working with JMS and Amazon SQS" and does sound like a more powerful tool.
p
@aliaspooryorik if you can explain alittle more about what your wanting to do I might be able to lean in.
SNS is fan out, SQS is 1:1. ( easest way to describe )
a
We generate documents in batches. We are running on AWS so can spin up instances on demand automatically (depending on CPU load or whatever). When an instance comes up I want it to know that there are documents pending (there is a queue on tasks to run in a database table) and pick one off the queue and generate it. Can't use a scheduled task as that just calls a URL whereas I want a instance not currently generating anything to be grabbing items from the queue of pending documents. It's the dynamic number of instances that makes it tricky.
Using an event gateway or similar seems to make sense here (rather than the usual request / response nature of a CF server)
p
So you want a queue?
Liek code that calls a queue and process the next tiem?
a
There is a queue in the sense we have a database table with all the pending things to do. In a simple world it'd be one server instance and it'd just poll to see if there was anything to do. With scheduled tasks polling is really calling a URL (rather than an instance) so as we're behind a load balancer it doesn't work with a multi instance, dynamically scaling setup.