Skip to content

Instantly share code, notes, and snippets.

@dipeshhkc
Created December 30, 2022 23:10
Show Gist options
  • Save dipeshhkc/a33854a4916921c8f1b1e855495c75e8 to your computer and use it in GitHub Desktop.
Save dipeshhkc/a33854a4916921c8f1b1e855495c75e8 to your computer and use it in GitHub Desktop.
func Task2Controller(c *gin.Context) {
ch := lib.RabbitChannel
err := ch.Publish(
"", // exchange
constants.QUEUE, // routing key
false, // mandatory
false, // immediate
amqp.Publishing{
ContentType: "text/plain",
Body: nil,
Type: constants.TASK2,
})
utils.FailOnError(err, "Failed to publish a message")
c.JSON(http.StatusOK, gin.H{
"message": "Task-2 Received Successfully",
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment