Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send a shutdown message to the broker before destroying a connection #7

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/amqp.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,11 @@ the connection bound to CONN."
(unwind-protect
(let ((,conn ,conn-sym))
,@body)
(destroy-connection ,conn-sym)))))
(progn
(ignore-errors
(connection-close ,conn-sym))
(ignore-errors
(destroy-connection ,conn-sym)))))))

(defmacro with-channel ((connection channel) &body body)
"Opens CHANNEL, evaluates BODY and ensures you don't leave without
Expand All @@ -190,7 +194,8 @@ closing the channel"
(unwind-protect
(progn (channel-open ,conn ,chan)
,@body)
(channel-close ,conn ,chan)))))
(ignore-errors
(channel-close ,conn ,chan))))))

;;;
;;; API calls
Expand Down Expand Up @@ -306,7 +311,7 @@ CONN - the connection object
CODE - the reason code for closing the connection. Defaults to AMQP_REPLY_SUCCESS."
(check-type code (or null integer))
(with-state (state conn)
(verify-rpc-framing-call state nil (amqp-connection-close state (or code +amqp-reply-success+)))))
(verify-rpc-reply state nil (amqp-connection-close state (or code +amqp-reply-success+)))))

(defun socket-open (socket host port)
"Open a socket connection.
Expand Down