dkuhlman
Elixir examples added to ZeroMQ zguide at Github
For those of you who might be interested in using ZeroMQ in Elixir, I converted the Erlang examples in the ZeroMQ “zguide” to Elixir. I used erl2ex (https://github.com/dazuma/erl2ex.git) to do the initial conversion, then did a bit of editing and testing. Most of these examples work. I was not able to convert a couple because they used a module that I could not find.
You can find these Elixir examples in the ZeroMQ “zguide” repository at https://github.com/booksbyus/zguide. Look in the examples/Elixir directory. See the README.md file for a summary of which examples seem to work and which do not.
Hope this is helpful.
Dave
First Post!
lawik
Cool. Is there a mature zmq lib for erlang or Elixir right now. I looked at it a few years back to try to transition some services to Elixir but lots of stuff was missing then and I didn’t know nearly ebough to fix it.
Multipart messages were missing at the time I believe.
Most Liked
dkuhlman
I used erlzmq2 from GitHub - zeromq/erlzmq2: Erlang binding for 0MQ (v2) · GitHub.
I did not try to push it very hard. I suspect it needs care and attention.
I also found that there were missing pieces that were used in the Erlang examples. In particular, I could not find erlzmq_device and erlzmq_util.
If I get time, I’ll try to investigate the multipart message capability.
Last Post!
dkuhlman
I’m curious, too. I looked just a little more closely. My understanding is really shallow, but, the following code in rrbroker.exs seems to handle multi-part messages:
def loop(frontend, backend) do
receive do
{:zmq, ^frontend, msg, flags} →
case(:proplists.get_bool(:rcvmore, flags)) do
true →
:erlzmq.send(backend, msg, [:sndmore])
false →
:erlzmq.send(backend, msg)
end
{:zmq, ^backend, msg, flags} →
case(:proplists.get_bool(:rcvmore, flags)) do
true →
:erlzmq.send(frontend, msg, [:sndmore])
false →
:erlzmq.send(frontend, msg)
end
end
loop(frontend, backend)
end
That example (rrbroker.exs) seems to work. But, I don’t know how it’s being done underneath in erlzmq (erlzmq2). Looks hopeful, though.
Popular in Guides/Tuts
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









