W/o Durability
activemq-sample.dylan
module: activemq-sample define function main (name :: <string>, arguments :: <vector>) start-sockets(); let sock = make(<TCP-socket>, host: "localhost", port: 61613); write(sock, "CONNECT\n\n\0"); force-output(sock; let line = read-line(sock); ; Skip the CONNECTED frame until (string-equal?(line, "\0")) line := read-line(sock); end until; write(sock, "SUBSCRIBE\ndestination:/topic/SampleTopic\n\nack:auto\n\n\0"); force-output(sock); line := read-line(sock); ; Seek to the body of the MESSAGE frame until (string-equal?(line, "")) line := read-line(sock); end until; format-out("%s\n", read-line(sock)); write(sock, "DISCONNECT\n\n\0"); close(sock); end function; main(application-name(), application-arguments());
activemq-sample.lid
library: activemq-sample files: library activemq-sample
library.dylan
module: dylan-user define library activemq-sample use common-dylan; use io; use network; use strings; export activemq-sample; end library; define module activemq-sample use common-dylan; use format-out; use streams; use sockets; use strings; end module;
W/ Durability
activemq-sample.dylan
module: activemq-sample define function main (name :: <string>, arguments :: <vector>) start-sockets(); let sock = make(<TCP-socket>, host: "localhost", port: 61613); write(sock, "CONNECT\nclient-id:SampleClient\n\n\0"); force-output(sock; let line = read-line(sock); ; Skip the CONNECTED frame until (string-equal?(line, "\0")) line := read-line(sock); end until; write(sock, "SUBSCRIBE\ndestination:/topic/SampleTopic\n\nack:auto\nactivemq.subscriptionName:SampleSubscription\n\n\0"); force-output(sock); line := read-line(sock); ; Seek to the body of the MESSAGE frame until (string-equal?(line, "")) line := read-line(sock); end until; format-out("%s\n", read-line(sock)); write(sock, "DISCONNECT\n\n\0"); close(sock); end function; main(application-name(), application-arguments());
activemq-sample.lid
library: activemq-sample files: library activemq-sample
library.dylan
module: dylan-user define library activemq-sample use common-dylan; use io; use network; use strings; export activemq-sample; end library; define module activemq-sample use common-dylan; use format-out; use streams; use sockets; use strings; end module;
Leave a comment