W/o Durability
(define stream (open-tcp-stream-socket "localhost" 61613)) (format stream "CONNECT~%~%~A" #\NUL) (flush-output stream) (let loop ((line (read-line stream))) (cond ((not (string=? line (string #\NUL))) (loop (read-line stream))))) ; Skip the CONNECTED frame (format stream "SUBSCRIBE~%destination:/topic/SampleTopic~%ack:auto~%~%~A" #\NUL) (flush-output stream) (let loop ((line (read-line stream))) (cond ((not (string=? line "")) (loop (read-line stream))))) ; Seek to the body of the MESSAGE frame (display (read-line stream)) (format stream "DISCONNECT~%~%~A" #\NUL) (close-port stream)
W/ Durability
(define stream (open-tcp-stream-socket "localhost" 61613)) (format stream "CONNECT~%client-id:SampleClient~%~%~A" #\NUL) (flush-output stream) (let loop ((line (read-line stream))) (cond ((not (string=? line (string #\NUL))) (loop (read-line stream))))) ; Skip the CONNECTED frame (format stream "SUBSCRIBE~%destination:/topic/SampleTopic~%ack:auto~%activemq.subscriptionName:SampleSubscription~%~%~A" #\NUL) (flush-output stream) (let loop ((line (read-line stream))) (cond ((not (string=? line "")) (loop (read-line stream))))) ; Seek to the body of the MESSAGE frame (display (read-line stream)) (format stream "DISCONNECT~%~%~A" #\NUL) (close-port stream)