dkuhlman

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

lawik

Nerves Core Team

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

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

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.

Where Next?

Popular in Guides/Tuts Top

bentanweihao
I wrote a thing: http://engineering.pivotal.io/post/how-to-set-up-an-elixir-cluster-on-amazon-ec2/ Hope this is helpful!
New
smpallen99
Did you know that IO.inspect/2 returns the the first argument and accepts a label option as a second argument. This makes it a perfect to...
New
anuragg
We finally have a Mix clustering guide to go with Phoenix deployment with Mix Releases. Deploy an Elixir Cluster with Mix Releases and l...
New
anuragg
We just published a guide to automatic clustering in Elixir 1.9, with Mix releases and libcluster. The cluster automatically discovers n...
New
dkuku
I Created a blog post about setting up svelte with phoenix. I found it a bit tricky and the only blog post I found was written using som...
New
1player
A question I had when first learning contexts and Ecto was how to expand the default context API to support more flexible queries. Usuall...
New
TwistingTwists
This is a thread to note down things/best practices encountered in LiveBeats App as I explore the source code. https://github.com/fly-...
New

Other popular topics Top

KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36820 110
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 55125 245
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

We're in Beta

About us Mission Statement