View Source Mammoth (mammoth v0.1.0)

Mammoth: A STOMP client.

Use Mammoth as the primary API and Mammoth.Message for working with received messages.

example

Example

{:ok, callback_pid} = Mammoth.DefaultCallbackHandler.start_link
{:ok, pid} = Mammoth.start_link(callback_pid)
Mammoth.connect(pid, {127,0,0,1}, 61613, "admin", "admin")
Mammoth.subscribe(pid, "foo.bar")
Mammoth.disconnect(pid)

starting-in-a-supervision-tree

Starting in a supervision tree

children = [
  worker(Mammoth, [%{}, [name: Mammoth]])
]

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Disconnect from server.

Requests disconnection from the remote server

Callback implementation for GenServer.init/1.

Receive messages from the TCP socket.

Subscribe to a queue.

Unsubscribe from a queue.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

connect(pid, host, port, login, password)

View Source

Connect to server.

host must be inet:socket_address() | inet:hostname(), for example {127,0,0,1}.

Disconnect from server.

Link to this function

handle_call(msg, from, state)

View Source

Requests disconnection from the remote server

Callback implementation for GenServer.init/1.

Receive messages from the TCP socket.

Is called automatically when necessary. Should not be called manually.

Link to this function

start_link(callback_handler, state \\ %{}, opts \\ [])

View Source
Link to this function

subscribe(pid, destination)

View Source

Subscribe to a queue.

Link to this function

unsubscribe(pid, destination)

View Source

Unsubscribe from a queue.