How to Send a Message to an Apache ActiveMQ Topic with Open Dylan

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");

  write(sock, "SEND\ndestination:/topic/SampleTopic\n\nSimples Assim\0");

  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;

  export activemq-sample;
end library;

define module activemq-sample
  use common-dylan;

  use streams;

  use sockets;
end module;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s