Permalink
Browse files

return multiple values from response handler

  • Loading branch information...
1 parent 8f76030 commit b605602261e02552b7105bc65945b4d32483cdad @lisp committed Jun 19, 2012
Showing with 10 additions and 5 deletions.
  1. +3 −1 commands.lisp
  2. +7 −4 device-level.lisp
View
@@ -624,11 +624,13 @@ any, is committed.")
args))
(:method ((basic amqp:basic) &rest args &key (body nil body-s)
- (exchange nil e-s)
+ (exchange nil e-s) (routing-key nil rk-s)
&allow-other-keys)
(when e-s
(setf exchange (amqp:exchange-exchange exchange)) ; coerce to a string
(setf (amqp:basic-exchange basic) exchange)) ; cache for possible use in chunk headers
+ (when rk-s
+ (setf (amqp:basic-routing-key basic) routing-key))
(when body-s
(setf args (copy-list args))
(remf args :body))
View
@@ -1332,7 +1332,7 @@ returned.")
(:method ((channel amqp:channel) (body-op function) (content-type mime:*/*))
"Given a the null type, just return the channel as a stream to be read."
- (prog1 (funcall body-op channel content-type)
+ (multiple-value-prog1 (funcall body-op channel content-type)
;; once the operator has read, clear to the end of the message
(device-clear-input channel nil)))
@@ -1457,6 +1457,7 @@ returned.")
"Given a null body , configure the channel to write the message body
and return the stream."
(declare (dynamic-extent args) (ignore args))
+ (stream-write-string channel "" 0 0)
nil)
(:method ((channel amqp:channel) (body string) (content-type mime:text/plain) &rest args)
@@ -1509,7 +1510,9 @@ returned.")
;; combination. this resolve the body size, the transfer encoding, and the
;; transfer element type
(let* ((basic ;; (apply #'device-write-content-header channel body args)))
- (apply #'device-initialize-content-header channel body args)))
+ (apply #'device-initialize-content-header channel body args))
+ (start-position (device-file-position channel)))
(setf (device-frame-position channel) 0)
- (prog1 (apply #'device-write-content-body channel body (mime:mime-type (amqp:basic-content-type basic)) args)
- (device-flush channel t)))))
+ (apply #'device-write-content-body channel body (mime:mime-type (amqp:basic-content-type basic)) args)
+ (device-flush channel t)
+ (- (device-file-position channel) start-position))))

0 comments on commit b605602

Please sign in to comment.