Sending RabbitMQ Message from JavaScript with async / await

I’m doing a lot of JavaScript development these days, and most of the example JS code I find on the web uses callbacks. I much prefer async/await, and sometimes the translation isn’t obvious.  

Here’s how to send a message using amqplib to RabbitMQ using async await.

The interesting bit here is the waitForConfirms method. You’d think you could await sendToQueue, and that would wait for the send to complete. However, the way amqpplib implements this, the call returns once the message is queued for sending. Without the waitForConfirms, the process.exit will run before the message is sent.