AMQP: skip duplicate messages

When using rabbit's mirrored queues or qpid's replicated queues, there
are conditions under which you can receive the same message twice.

One such condition is where a message has been sent to a consumer but
before an ack is received by a consumer, the master fails over to a
slave and the slave resends the message. Note that the consumer may have
sent the ack, but it was lost as the master went down.

Dispatching the same message twice is obviously something we want to
avoid. In order to do so, we add a unique_id to each message sent and
have consumers maintain a fixed length queue of recently seen unique
message IDs. Before dispatching any received message, the queue is
checked and the message is skipped if it is a duplicate.

Fixes bugs 1107064.

Change-Id: I5bfacadbdf7de8b34d6370b9aa869c271957692d