Thread safe operations with LibPQ.jl and AMPQ.jl

How should I implement thread safe operations with LibPQ.jl (PostgreSQL database) and AMPQ.jl (RabbitMQ)? I’m using 8 threads, and I pulling/pushing messages from/to RabbitMQ (using only one queue). Also, I’m using PostgreSQL database operations INSERT/SELECT.

Should I use some kind of semaphore, lock, or atomic variable when executing commands “execute” and “basic_get”?

I’m looking for general, simple example which can help me understand how it is working in Julia language. For example 8 threads, each of them has DB and queue connection.

Thank you

Both data bases (like Postgres) and message queues (like Rabbit) already support multiple clients doing read / write operations at the same time, even if it is on the same tables / queues.
Are there any concreate issues you encountered?

PostgreSQL and RabbitMQ like service - support multiple clients doing read / write. - Yes, I know it.

I meant concrete package AMQP.jl and LibPQ.jl, does it support? What happen if I’ll pull message from same RabbitMQ queue in same channel on 8 threads in same time? I’m C++ developer so maybe I’m thinking about this issue in lower level.

Similar for PostgreSQL. I know that database as service is supporting multiple INSERT and so on. I meant example: All threads are executing function “execute” in same time from package PostgreSQL.jl. Is it supported by this package?

Let’s summarize it: If we have more threads, we cannot write value to same variable in same time. It must be handled f.e. by semaphore. Regarding to LibPQ.jl and RabbitMQ.jl → Is this implemented in packages? Is this thread safe?

Thank you