anchor.diff:  			 :handle handle))))
   
   (defun close-queue (q)
  +  "Close the previously opened queue."
     (declare (type client-queue q))
     (rpc-close (client-queue-conn q)))
   
  -(defun post-message (client data)
  -  "Post a message to the queue. Returns immediately, the server does not acknowledge receipt of the message."
  -  (declare (type client-queue client))
  -  (incf (client-queue-id client))
  -  (call-post (client-queue-handle client)
  -	     (client-queue-id client)   
  +(defun post-message (queue data &optional id)
  +  "Post a message to the queue. Returns immediately, does not acknowledge the server received the message.
  +
  +ID ::= if supplied, is an integer to be used as the message id, otherwise an autogenerated id will be used.
  +
  +Returns the ID of the message sent to the queue."
  +  (declare (type client-queue queue))
  +  (unless id 
  +    (incf (client-queue-id queue))
  +    (setf id (client-queue-id queue)))
  +  (call-post (client-queue-handle queue)
  +	     (client-queue-id queue)   
   	     data
  -	     :connection (client-queue-conn client)
  -	     :timeout nil))
  +	     :connection (client-queue-conn queue)
  +	     :timeout nil)
  +  id)
   	     
   ;; ----------------------------
   
  
positive.code:   conn handle id)
  
  (defun open-queue (host handle)
    "Open a remote queue. Returns a client to be used to send messages."
    (declare (type integer handle))
    (let ((port (frpc.bind:call-get-port (program-id 'rpcmq) 1 
  				       :host host)))
  
negative.code:         (t 
           ;; block until the condition varaible is signalled
           (if timeout
  	     (handler-case (bt:with-timeout (timeout) (bt:condition-wait (mq-condv queue) (mq-lock queue)))
  	       (bt:timeout () (return-from get-message nil)))
  	     (bt:condition-wait (mq-condv queue) (mq-lock queue)))
           (let ((m (dequeue (mq-messages queue))))
             (values (message-data m) (message-id m))))))))
  
  ;; ------------------------------------
  