Created
December 30, 2022 23:06
-
-
Save dipeshhkc/0ff1af452152189c291acd9f0d58d812 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var RabbitChannel *amqp.Channel | |
var rabbitConn *amqp.Connection | |
//SetupRabbbitMQConnectionChannel -> setup rabbit mq channel | |
func SetupRabbbitMQConnectionChannel() (*amqp.Connection, *amqp.Channel) { | |
//dial | |
url := fmt.Sprintf("amqp://%s:%s@%s:%s/", constants.USERNAME, constants.PASSWORD, constants.HOST, constants.PORT) | |
conn, err := amqp.Dial(url) | |
utils.FailOnError(err, "Failed to connect to RabbitMQ") | |
ch, err := conn.Channel() | |
utils.FailOnError(err, "Failed to open a channel") | |
RabbitChannel = ch | |
return rabbitConn, RabbitChannel | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment