Software

How to Receive a Message from an Apache ActiveMQ Topic with Interfix

W/o Durability

fn+ main:
  Conn is (stomp :: connect "localhost" 61613 "" "")

  stomp :: subscribe "/topic/SampleTopic" Conn

  F is (fn Msg: io :: fwrite "~p~n" [Msg])

  stomp :: on_message F Conn

  stomp :: disconnect Conn.

W/ Durability

fn+ main:
  Conn is (stomp :: connect "localhost" 61613 "" "" [#["client-id" "SampleClient"]])

  stomp :: subscribe "/topic/SampleTopic" Conn [#["activemq.subscriptionName" "SampleSubscription"]]

  F is (fn Msg: io :: fwrite "~p~n" [Msg])

  stomp :: on_message F Conn

  stomp :: disconnect Conn.
Software

How to Receive a Message from an Apache ActiveMQ Topic with Efene

W/o Durability

@import(io, [fwrite/2])
@import(stomp, [connect/4, disconnect/1, on_message/2, subscribe/2])

fn main @public case:
  Conn = connect("localhost", 61613, "", "")

  subscribe("/topic/SampleTopic", Conn)

  F = fn case Msg: fwrite("~p~n", [Msg]) end

  on_message(F, Conn)

  disconnect(Conn)
end

W/ Durability

@import(io, [fwrite/2])
@import(stomp, [connect/5, disconnect/1, on_message/2, subscribe/3])

fn main @public case:
  Conn = connect("localhost", 61613, "", "", [{"client-id", "SampleClient"}])

  subscribe("SampleQueue", Conn, [{"activemq.subscriptionName", "SampleSubscription"}])

  F = fn case Msg: fwrite("~p~n", [Msg]) end

  on_message(F, Conn)

  disconnect(Conn)
end
Software

How to Receive a Message from an Apache ActiveMQ Topic with LFE

W/o Durability

(defmodule activemq_sample (export (main 0)))

(defun main ()
  (let ((conn (: stomp connect '"localhost" 61613 '"" '"" )) (f (lambda (msg) (: lfe_io fwrite '"~p~n" (list msg)))))
    (: stomp subscribe '"/topic/SampleTopic" conn)

    (: stomp on_message f conn)

    (: stomp disconnect conn)
  )
)

W/ Durability

(defmodule activemq_sample (export (main 0)))

(defun main ()
  (let ((conn (: stomp connect '"localhost" 61613 '"" '"" (list (tuple '"client-id" '"SampleClient")))) (f (lambda (msg) (: lfe_io fwrite '"~p~n" (list msg)))))
    (: stomp subscribe '"/topic/SampleTopic2" conn (list (tuple '"activemq.subscriptionName" '"SampleSubscription")))

    (: stomp on_message f conn)

    (: stomp disconnect conn)
  )
)