W/o Durability
(in-package :usocket) (with-client-socket (socket stream "localhost" 61613) (format stream "CONNECT~%~%~C" #\Null) (force-output stream) ; Skip the CONNECTED frame (loop for line = (read-line stream) until (string= line #\Null)) (format stream "SUBSCRIBE~%destination:/topic/SampleTopic~%ack:auto~%~%~C" #\Null) (force-output stream) ; Seek to the body of the MESSAGE frame (loop for line = (read-line stream) until (string= line "")) (print (read-line stream)) (format stream "DISCONNECT~%~%~C" #\Null) )
W/ Durability
(in-package :usocket) (with-client-socket (socket stream "localhost" 61613) (format stream "CONNECT~%client-id:SampleClient~%~%~C" #\Null) (force-output stream) ; Skip the CONNECTED frame (loop for line = (read-line stream) until (string= line #\Null)) (format stream "SUBSCRIBE~%destination:/topic/SampleTopic~%ack:auto~%activemq.subscriptionName:SampleSubscription~%~%~C" #\Null) (force-output stream) ; Seek to the body of the MESSAGE frame (loop for line = (read-line stream) until (string= line "")) (print (read-line stream)) (format stream "DISCONNECT~%~%~C" #\Null) )