Implement connecting and subscribing

This commit is contained in:
Vincent Ambo 2016-02-09 01:17:21 +01:00
parent 0d608be29c
commit e3fdb8c8c7
No known key found for this signature in database
GPG key ID: 66F505681DB8F43B
6 changed files with 201 additions and 5 deletions

View file

@ -9,7 +9,7 @@ It provides an application called `stomp` which takes configuration of the form:
```erlang
[{stomp, #{host => "stomp-server.somedomain.sexy", % required
port => 61613, % required
port => 61613, % optional
login => <<"someuser">>, % optional
passcode => <<"hunter2>>, % optional
}}].
@ -47,12 +47,11 @@ Once the application starts it will register a process under the name
%% Subscribe to a destination, receive the subscription ID
-spec subscribe(binary(), % Destination (e.g. <<"/queue/lizards">>)
ack_mode(), % Client-acknowledgement mode
pid()) % PID of the process that wants to receive messages
-> {ok, sub_id()}.
```
This synchronous call subscribes to a message queue. The `stomp_worker` will
link itself to the PID and forward received messages as
link itself to the caller and forward received messages as
`{msg, sub_id(), stomp_msg()}`.
Depending on the acknowledgement mode specified on connecting, the subscriber