Collects SNS messages from Westfield API's, stores them in redis, and then get requests to the service generate url's on the fly.
Sitemap service uses Redis to store records for all products, events, stores, retailers, and deals. You will need redis installed. Easiest with brew.
$ brew install redis
$ redis-server
$ bundle install
$ rails s
You can use the rake tasks to backfill data to redis. Each country uses it's own database. The rake tasks will dump into each accordingly. The schema is as follows.
db 0 = AU
db 1 = UK
db 2 = US
db 3 = NZ
db 4 = Maps index and Resque queue.
Products is extremely large, and I wouldn't recommend using the rake task for devleopment.
$ rake get_deals:map
$ rake get_stores:map
$ rake get_events:map
$ rake get_deals:map
Once the you have some sample data, you will need to generate the sitemap index.
$ rake index:map
In development everything will be processed though posting to the /map route. In production all posts and rake tasks are handled by Resque in the jobs folder.
You can manually post to the maps controller to populate data. the post will need to include a a custom token as we are verifying sns messages to ensure they are coming form amazon. the request raw post needs to look something like this. The Type, token, and message fields need to be there for development. Format precise, and this token is needed.
localhost:3000/map
{
"Type" : "Notification",
"Token" : "^&6NC0$tU7i5%Hy^#2HB#%98gp8Tb@",
"Subject" : "Testing publish to subscribed queues",
"Message" : "{\"sender\":\"store-service-uat\",\"type\":\"store_update\",\"data\":{\"uri\":\"https://api.westfield.io/stores/56900\",\"id\":56900}}"
}
Open a browser, and go to the index. substitute country in the url to see the index for each country.
http://localhost:3000/map/au/sitemapindex.xml
Copy the relative link in the index and append to local host.
http://localhost:3000/map/au/deals1.xml