File tree 2 files changed +45
-0
lines changed
2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ sbcl --noinform --noprint $@ << EOF
4
+
5
+ (ql:quickload :cl-bunny.examples)
6
+
7
+ (in-package :cl-bunny.examples)
8
+
9
+ (with-connection ()
10
+ (with-channel ()
11
+ (let ((x (exchange.default))
12
+ (msg (format nil "~{~a~^ ~}" (cdr sb-ext:*posix-argv*))))
13
+ (publish x msg :routing-key "task_queue"
14
+ :properties '(:persistent t))
15
+ (format t " [x] Sent '~a'~%" msg))))
16
+
17
+ EOF
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ sbcl --noinform --noprint << EOF
4
+
5
+ (ql:quickload :cl-bunny.examples)
6
+
7
+ (in-package :cl-bunny.examples)
8
+
9
+ (with-connection ()
10
+ (with-channel ()
11
+ (let ((q (queue.declare :name "task_queue" :durable t)))
12
+ (format t " [*] Waiting for messages in queue 'task_queue'. To exit press CTRL+C~%")
13
+ (qos :prefetch-count 1)
14
+ (handler-case
15
+ (progn
16
+ (subscribe q (lambda (message)
17
+ (let ((body (message-body-string message)))
18
+ (format t " [x] Received '~a'~%" body)
19
+ ;; imitate some work
20
+ (sleep (count #\. body))
21
+ (message.ack message)
22
+ (format t " [x] Done~%")))
23
+ :type :sync)
24
+ (consume))
25
+ (sb-sys:interactive-interrupt ()
26
+ (sb-ext:exit))))))
27
+
28
+ EOF
You can’t perform that action at this time.
0 commit comments