[services] Tunnelbroker - Add AMQP shared channel locking
Summary:
Following comments in D4740 from the synchronization question and forward, ENG-1495 task, we should use a synchronization mechanism in access to the AMQP Client channel which is accessed from the different threads (gRPC threads + DeliveryBroker thread) by calling send() and ack() methods.
When the number of threads grows non-synchronized access to the shared channel causes a segmentation fault or AMQP-CPP TCP Connection buffer error.
This diff introduces the use of C++17 std::scoped_lock which provides a convenient RAII-style mechanism for owning a shared channel.
Usage of the std::scoped_lock was added to the send() and ack() methods which are called from the threads.
Related Linear task: ENG-1495
Test Plan: Successfully pass a stress test in D4768 with multiple threads sending messages at once.
Reviewers: karol, tomek
Reviewed By: tomek
Subscribers: jon, ashoat, tomek, adrian, atul, karol, abosh
Differential Revision: https://phab.comm.dev/D4767