Q interfacing with Erlang/OTP

Hi everyone,

we created some Erlang/OTP applications in the past and therefore we wrote a small lib to talk to Q from Erlang using standard OPT behaviours (gen_server and gen_event).

You can find the code on github: https://github.com/cinovo/erlang-q

If you use rebar just add

{deps, [
    {q, “.*”, {git, “git://github.com/cinovo/erlang-q.git”, {tag, “v0.1.2”}}}
]}.

to your dependencies.

Request/response is supported:

{ok, Pid} = q:connect(<<“localhost”>>, 5000).
2 = q:execute(Pid, <<“1+1”>>).

or

15 = q:execute(Pid, <<“sum”>>, q_ipcp:serialize_ints([1, 2, 3, 4, 5])).

 and subscriptions via kdb+tick:

{ok, Pid} = q:connect({q_demo_handler, }, <<“localhost”>>, 5000).
q:subscribe(Pid, <<“trade”>>, <<“TEST”>>).

Feel free to fork :)

Regards,

Michael

1 Like