[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 {
|
||||
log.Println("test rabbit publish method calling...")
|
||||
|
||||
q := h.amqp.DeclareQueue("article_queue_test")
|
||||
q := h.Queue.DeclareQueue("article_queue_test")
|
||||
m := ArticleGenerateHeavyPDFMessage{
|
||||
Title: "Test title",
|
||||
Content: "Lorem ipsum dolor sit amet",
|
||||
@ -51,7 +51,7 @@ func (h *ArticlesHandler) testRabbit(c echo.Context) error {
|
||||
}
|
||||
|
||||
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"
|
||||
return c.JSON(http.StatusOK, response)
|
||||
|
@ -29,16 +29,16 @@ func DeserializeFromRequest(request *http.Request, output interface{}) {
|
||||
|
||||
// BaseHandler type
|
||||
type BaseHandler struct {
|
||||
Queue *queue.AMQP
|
||||
db *database.MongoDb
|
||||
amqp *queue.AMQP
|
||||
validator *validator.Validate
|
||||
}
|
||||
|
||||
// NewHandler Create BaseHandler instance
|
||||
func NewHandler() *BaseHandler {
|
||||
return &BaseHandler{
|
||||
Queue: queue.New(),
|
||||
db: database.New(),
|
||||
amqp: queue.New(),
|
||||
validator: validator.New(),
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user