Beispiel #1
0
func main() {
	server, err := mgo.Dial("localhost")
	if err != nil {
		log.Error("Unable to dail to mongo: %v", err)
		log.Error("Are you sure mongod is running?")
	} else {
		database := server.DB("promise")
		session := mongo.NewMongoPromiseSession(server, database)
		repoFac := mongo.NewMongoPromiseRepositoryFactory(session)
		repo := repoFac.CreatePromiseTicketRepository()
		marsh := serialization.NewJsonMarshaller()
		bus := messaging.NewNsqBus()
		ctrl := controller.NewPromiseTicketController(repo, bus, marsh)

		Serve(&ServeInfo{
			uri: ":8080",
			promiseTicketController: ctrl,
		})
	}

	// Let log4go flush
	time.Sleep(time.Second)
}
Beispiel #2
0
func NewNsqBus() *NsqBus {
	return &NsqBus{
		marshaller: serialization.NewJsonMarshaller(),
	}
}