Skip to content

Golang app to process messages from AmazonSQS into mongo for realtime inventory

Notifications You must be signed in to change notification settings

pfortin-urbn/GoUrbanInventoryProcessor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

URBN Go Inventory Processor

The URBN GO Inventory Processor is a golang app that will listen on Amazon SQS Queues for inventory Pool Definition and Inventory Fact Messages and process them into mongo.

##QuickStart

  • Install go on your system
  • Clone the repository
  • Check that the config file is what you want
  • use the command: "go run ./inventory_processor.go" to start the application

##Config

Configuration is done via a JSON file called config.json (sample below). The config can be reloaded at any time using the web interface. and is stored in the following GoLang struct

type Configuration struct {
	Amazon struct {
        AccountNumber     		        string 	`json:"accountNumber"`
        Endpoint          		        string 	`json:"endpoint"`
        QueueURL          		        string 	`json:"queueUrl"`
        Region            		        string 	`json:"region"`
        InventoryFactsQueueName 	    string 	`json:"inventoryFactsQueueName"`
        InventoryPoolsQueueName 	    string 	`json:"inventoryPoolsQueueName"`
    } 									        `json:"amazon"`
	App struct {
        NumDefinitionRoutines 	        int 	`json:"numDefinitionRoutines"`
        NumFactsRoutines      	        int 	`json:"numFactsRoutines"`
    } 									`json:"app"`
	Mongo struct {
        DB              			    string 	`json:"dB"`
        FactsCollection 			    string 	`json:"factsCollection"`
        HostAndPort     			    string 	`json:"hostAndPort"`
        PoolsCollection 			    string 	`json:"poolsCollection"`
    } 									        `json:"mongo"`
}

Amazon:

  • Amazon.Endpoint
  • Amazon.AccountNumber (Remenber the leading and trailing '/')
    • ElasticMQ - "/queue/"
    • Amazon - "/98XXXXXXX86/"
  • Amazon.Region
    • always set to "us-east-1" for now (even with ElasticMQ)
  • Amazon.QueueUrl
  • Amazon.InventoryPoolsQueueName - Inventory Pools Queue Name
  • Amazon.InventoryFactsQueueName - Inventory Facts Queue Name

Mongo:

  • Mongo.HostAndPort - (i.e.: "localhost:27017")
  • Mongo.DB - DB Name -
  • Mongo.PoolsCollection - Inventory Definition Collection
  • Mongo.FactsCollection - Inventory Pools Collection

Misc:

  • App.NumDefinitionRoutines - number of goroutines that will process inventory definitions simultaneously.
  • App.NumFactsRoutines - number of goroutines that will process inventory facts simultaneously

About

Golang app to process messages from AmazonSQS into mongo for realtime inventory

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published