Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

provide integer-equivalent expiration times to publish

  • Loading branch information...
commit ca417ab97691f5f910a4e00f556e2bb731261ea0 1 parent dfb9a72
@lisp authored
View
6 commands.lisp
@@ -596,6 +596,8 @@ messages in between sending the cancel method and receiving the cancel-ok reply.
(:method ((class amqp::channel) &key &allow-other-keys)
class)))
+(defparameter *publish-expiration* "100000"
+ "Value in milliseconds. COuld also be a default value in the instance, but this is more direct,")
(def-amqp-command amqp:publish (class &key body exchange routing-key mandatory immediate
content-type content-encoding headers delivery-mode
@@ -625,6 +627,7 @@ any, is committed.")
(:method ((basic amqp:basic) &rest args &key (body nil body-s)
(exchange nil e-s) (routing-key nil rk-s)
(user-id (or (basic-user-id basic) ""))
+ (expiration *publish-expiration*)
&allow-other-keys)
(when e-s
(setf exchange (amqp:exchange-exchange exchange)) ; coerce to a string
@@ -636,7 +639,8 @@ any, is committed.")
(remf args :body))
(apply #'shared-initialize basic t args)
(let ((channel (object-channel basic)))
- (apply #'device-write-content channel body :exchange exchange :user-id user-id args)))))
+ (apply #'device-write-content channel body :exchange exchange :user-id user-id
+ :expiration expiration args)))))
(def-amqp-command amqp:purge (class &key queue no-wait)
View
25 readmes/example-streams.lisp
@@ -34,6 +34,27 @@
(read-line input))
+;;; fails
+
+ DEVICE-READ: Required device state USE-CHANNEL.BODY.INPUT is not satisfied by #<USE-CHANNEL
+
+ {1001DFFF11}>.
+
+Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
+
+restarts (invokable by number or by possibly-abbreviated name):
+ 0: [CONTINUE] Retry assertion.
+ 1: [ABORT ] Exit debugger, returning to top level.
+
+(SB-KERNEL:ASSERT-ERROR
+ (TYPEP #:G360 'AMQP.S:USE-CHANNEL.BODY.INPUT)
+ NIL
+ "~@[~a: ~]Required device state ~a is not satisfied by ~a."
+ DEVICE-READ
+ AMQP.S:USE-CHANNEL.BODY.INPUT
+ #<AMQP.S:USE-CHANNEL {1001DFFF11}>)
+0]
+
(amqp:with-open-channel (output *c* :exchange "ex" :type "direct" :queue "q1")
(let ((message '("there" "comes" "a" "time" "when" "the" "mind" "takes" "a" "higher" "plane"
@@ -49,4 +70,6 @@
(amqp:with-open-channel (input *c* :queue "q1")
(loop
(unless (print (read-line input nil nil))
- (return))))
+ (return))))
+
+(close *c* :abort t)
View
2  readmes/examples.lisp
@@ -53,7 +53,9 @@
(amqp:request-publish *ch1.basic* :exchange *ch1.ex*
:body (format nil "a test message")
:routing-key "foaf")
+ ;; should yield the message
(amqp:request-get *ch2.basic* :queue *ch2.q*)
+ ;; should be empty
(amqp:request-get *ch1.basic* :queue *ch1.q*))
#|
Please sign in to comment.
Something went wrong with that request. Please try again.