[fix] Renamed amqp var and make it public
This commit is contained in:
parent
27222a479e
commit
f0bb9cf00d
@ -43,7 +43,7 @@ type ArticleGenerateHeavyPDFMessage struct {
|
|||||||
func (h *ArticlesHandler) testRabbit(c echo.Context) error {
|
func (h *ArticlesHandler) testRabbit(c echo.Context) error {
|
||||||
log.Println("test rabbit publish method calling...")
|
log.Println("test rabbit publish method calling...")
|
||||||
|
|
||||||
q := h.amqp.DeclareQueue("article_queue_test")
|
q := h.Queue.DeclareQueue("article_queue_test")
|
||||||
m := ArticleGenerateHeavyPDFMessage{
|
m := ArticleGenerateHeavyPDFMessage{
|
||||||
Title: "Test title",
|
Title: "Test title",
|
||||||
Content: "Lorem ipsum dolor sit amet",
|
Content: "Lorem ipsum dolor sit amet",
|
||||||
@ -51,7 +51,7 @@ func (h *ArticlesHandler) testRabbit(c echo.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body, _ := h.JSONEncode(m)
|
body, _ := h.JSONEncode(m)
|
||||||
h.amqp.Publish(q.Name, body, "application/json")
|
h.Queue.Publish(q.Name, body, "application/json")
|
||||||
|
|
||||||
response := "Please wait until generating pdf or some other long task (in rabbitMQ queue) done"
|
response := "Please wait until generating pdf or some other long task (in rabbitMQ queue) done"
|
||||||
return c.JSON(http.StatusOK, response)
|
return c.JSON(http.StatusOK, response)
|
||||||
|
@ -29,16 +29,16 @@ func DeserializeFromRequest(request *http.Request, output interface{}) {
|
|||||||
|
|
||||||
// BaseHandler type
|
// BaseHandler type
|
||||||
type BaseHandler struct {
|
type BaseHandler struct {
|
||||||
|
Queue *queue.AMQP
|
||||||
db *database.MongoDb
|
db *database.MongoDb
|
||||||
amqp *queue.AMQP
|
|
||||||
validator *validator.Validate
|
validator *validator.Validate
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewHandler Create BaseHandler instance
|
// NewHandler Create BaseHandler instance
|
||||||
func NewHandler() *BaseHandler {
|
func NewHandler() *BaseHandler {
|
||||||
return &BaseHandler{
|
return &BaseHandler{
|
||||||
|
Queue: queue.New(),
|
||||||
db: database.New(),
|
db: database.New(),
|
||||||
amqp: queue.New(),
|
|
||||||
validator: validator.New(),
|
validator: validator.New(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user