Rabbitmq worker with mysql database

hello, i am new into go and have some problem with a worker connecting to rabbitmq


	var msg Message
	for d := range deliveries {
		if err := json.Unmarshal(d.Body, &msg); err != nil {
			log.Printf("err: %s", err)
		MysqlMap(msg.ID, msg.Source)
	log.Printf("handle: deliveries channel closed")
	done <- nil

when calling the MysqlMap() function, consuming messages from rabbitmq is really slow (2msg/sec), without this function and i.e. just printing the message is expected fast (10000 messages take ~5sec)

the mysql function itself is just a simple select which maps some id's based from the received rabbit message

if calling the mysql function directly it takes around 10ms to execute and i am running everything locally 

do i have to integrate the mysql function in a different way, as goroutine? if so could someone provide a quick example how it would need to be implemented?


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.