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* ((args (rest sb-ext:*posix-argv*))
12
+ (severity (or (first args) "info"))
13
+ (msg (format nil "~{~a~^ ~}" (rest args)))
14
+ (x (exchange.topic "topic_logs")))
15
+ (publish x msg :routing-key severity)
16
+ (format t " [x] Sent '~a'~%" msg))))
17
+
18
+ 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
+ (if-let ((args (rest sb-ext:*posix-argv*)))
10
+ (with-connection ()
11
+ (with-channel ()
12
+ (let ((q (queue.declare :auto-delete t))
13
+ (x (exchange.topic "topic_logs")))
14
+ (loop for severity in args do
15
+ (queue.bind q x :routing-key severity))
16
+ (format t " [*] Waiting for logs. To exit press CTRL+C~%")
17
+ (handler-case
18
+ (progn
19
+ (subscribe q (lambda (message)
20
+ (format t " [x] #~a:~a~%" (message-routing-key message) (message-body-string message)))
21
+ :type :sync)
22
+ (consume))
23
+ (sb-sys:interactive-interrupt ()
24
+ (sb-ext:exit))))))
25
+ (format t "Usage: $0 [binding key]~%"))
26
+
27
+ EOF
You can’t perform that action at this time.
0 commit comments