Skip to content

Commit

Permalink
common-lisp: tutorial one code
Browse files Browse the repository at this point in the history
  • Loading branch information
deadtrickster committed Mar 2, 2016
1 parent 4287f7a commit 5164733
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
23 changes: 23 additions & 0 deletions common-lisp/receive.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

sbcl --noinform --noprint <<EOF
(ql:quickload :cl-bunny.examples)
(in-package :cl-bunny.examples)
(with-connection ("amqp://")
(with-channel ()
(let ((q (queue.declare :name "hello")))
(format t " [*] Waiting for messages in queue 'hello'. To exit press CTRL+C~%")
(handler-case
(progn
(subscribe q (lambda (message)
(format t " [x] Received ~a~%" (message-body-string message)))
:type :sync
:no-ack t)
(consume))
(sb-sys:interactive-interrupt ()
(sb-ext:exit))))))
EOF
14 changes: 14 additions & 0 deletions common-lisp/send.lisp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

sbcl --noinform --noprint <<EOF
(ql:quickload :cl-bunny.examples)
(in-package :cl-bunny.examples)
(with-connection ("amqp://")
(with-channel ()
(publish (exchange.default) "Hello world!" :routing-key "hello")
(format t " [x] Sent 'Hello World!'~%")))
EOF

0 comments on commit 5164733

Please sign in to comment.