The scenario:
I have a single producer and consumer with only one queue which transfers messages. The consumer will update a value on DB according to the message that has consumed it. No operations should be sent to the DB in parallel. So, we shouldn't do anything that causes the data concurrency on DB. I use prefetch(1)
to receive one message at a time. Does removing the prefetch()
cause multiple operations to be sent to the DB in parallel or not?
Does consumer process messages in a single-threaded processor without prefetch()
or not?