in sender/ConnectionWrapper.go [96:115]
func (w *ConnectionWrapperImpl) Send(message connectionPoolMessage) error {
w.mutex.Lock()
defer w.mutex.Unlock() //deliberate - don't release mutex until we have either published or failed. that will ensure
//that the counter actually does correspond to the delivery tag
w.sendCounter += 1
w.awaitingConfirmation[w.sendCounter] = message
return w.amqpChannel.Publish(message.exchange,
message.routingKey,
true,
false,
amqp.Publishing{
Headers: map[string]interface{}{"Timestamp": message.timestamp.Format(time.RFC3339Nano)},
ContentEncoding: "utf-8",
ContentType: "application/json",
Timestamp: message.timestamp,
MessageId: message.msgId.String(),
Body: *message.content,
})
}