elephant v0.1.0 Elephant View Source

Elephant: A STOMP client.

Example:

{:ok, conn} = Elephant.connect({127,0,0,1}, 61613, "admin", "admin")

callback = fn
  %Elephant.Message{command: :message, headers: headers, body: body} ->
    Logger.info(["Received MESSAGE", "\nheaders: ", inspect(headers), "\nbody: ", inspect(body)])

  %Elephant.Message{command: :error, headers: headers, body: body} ->
    Logger.error(["Received ERROR", "\nheaders: ", inspect(headers), "\nbody: ", inspect(body)])

  %Elephant.Message{command: cmd, headers: headers, body: body} ->
    Logger.error([
      "Received unknown command: ", cmd, 
      "\nheaders: ",
      inspect(headers),
      "\nbody: ",
      inspect(body)
    ])
end

Elephant.subscribe(conn, "foo.bar", callback)

Link to this section Summary

Functions

Connect to server, returns socket

Subscribe to a topic or queue

Link to this section Functions

Link to this function connect(host, port, login, password) View Source

Connect to server, returns socket.

Link to this function subscribe(conn, destination, callback) View Source

Subscribe to a topic or queue.