Implement synchronous publish

Really what I want is to be able to transact with databases, such that
e.g., a row is deleted safely once the acknowledgment has
arrived. There is a deeper integration with replay and deduplication
implied by that, however.

For a start, this modifies the connection so that it will store an
application-supplied reference, and notify the (message) receiver when
acks come in. The public module makes use of this to wait for the ack
(or a timeout) before returning from `publish_sync`.