passing events from erlang to Clojure - erlang

I'm looking for a way to pass events back and forth between Clojure and erlang.
has someone done this before?
how should I encode the (immutable) messages in a flaxable general way?
Should IPC be used for this? what sort?
where has this gone wrong for you in the past?

You could use jinterface from clojure and be able to act as an Erlang node and send out multiple Pids associated with your node, in the Erlang cluster.

You've got lots of options as long as you use a socket (e.g. TCP/IP).
Have you considered JSON?
XML?
I can't say I've done Clojure <--> Erlang bridges before but "talking" to Erlang in JSON/XML is sufficiently painless.
Of course you can use the erl_interface (binary exchange protocol) but then you'll need (probably unless there is a lib for this) to craft a marshaller for this in Clojure.

Related

Interprocess communication in Lua with Example?

I have been struggling a lot to get this to work.
Can someone provide an example with any LUA api of 2 scripts that pass a message back and forth.
I have tried Oil, lua-ipc and zeromq.
But I face several missing libraries issues.
The ultimate goal is to pass a vector of numbers from one Lua process to another Lua process (with a different version of Lua) without going through disk.
Here is a similar example in python of IPC in a single file. Something similar in lua would be extremely helpful.
I really need an example as my knowledge in pipes or UDP/TCP is not strong.
The equivalent would be to use luasocket. These examples come very close to the python example given. Here socket:receive() is used for the framing.
https://github.com/diegonehab/luasocket/blob/master/samples/listener.lua
https://github.com/diegonehab/luasocket/blob/master/samples/talker.lua

http hook/callback with ejabberd

From ejabberd's webpage, I learn that one can extend ejabberd's functionality by writing modules using hooks/events etc. However, all the examples are in erlang, which I don't really know how to use. Of course, I can go learn it, but my question is whether I can avoid it altogether. Namely, is the following possible:
I write some REST server (using something else, like node.js/golang/python whatever), and then somehow hook it into ejabberd's event system.
What is the best way to go about this? Any link to a code example/tutorial would be great!
Thanks a lot.
It depends on what kind of feature you want to write. For some modules, you may want to use the internal API. Please note that you can use Erlang or Elixir, which is much easier. For example, here is how to write an Elixir module:
https://blog.process-one.net/elixir-sips-ejabberd-with-elixir-part-1/
The other approach is to use the Jabber XMPP component protocol. It is more limited but allow you to write XMPP components in any languages. Here is a description of Jabber component protocol, supported by ejabberd:
http://xmpp.org/extensions/xep-0114.html

Corba Trading Service inspecting tool

Is there any tool for viewing registered types in CORBA Trading Service, and maybe, for making some simple queries for objects?
I am using TAO, if it matters.
Not that I know off. Maybe you can write your own and contribute it back to TAO. Maybe consider a scripting language for a client, like Ruby with the R2CORBA implementation which is interoperable with TAO

Can jInterface be used without nodes?

The whole node concept in Erlang assumes that the nodes are secure.. always. There are roundabout methods floating on how to solve this problem but no real Erlang node solution.
I am in the process of building nodes between Java and Erlang but have the problem of security. Now I am faced with ssl over tcp/udp. I don't want to write my own protocol (disregarding the application level protocol) if I don't have to.
Can I use jInterface to parse terms to & from an Erlang tcp/udp server if I use binary_to_term & term_to_binary on the Erlang side?
Of course you can use the library to decode terms. By the way there exist BERT (Binary ERlang Term) that you may use for communication.

What weaknesses can be found in using Erlang?

I am considering Erlang as a potential for my upcoming project. I need a "Highly scalable, highly reliable" (duh, what project doesn't?) web server to accept HTTP requests, but not really serve up HTML. We have thousands of distributed clients (other systems, not users) that will be submitting binary data to central cluster of servers for offline processing. Responses would be very short, success, fail, error code, minimal data. We want to use HTTP since it is our best chance of traversing firewalls.
Given this limited information about the project, can you provide any weaknesses that might pop up using a technology like Erlang? For instance, I understand Erlang's text processing capabilities might leave something to be desired.
You comments are appreciated.
Thanks.
This sounds like a perfect candidate for a language like Erlang. The scaling properties of the language are very good, but if you're worried about the data processing abilities, you shouldn't be. It's a very powerful language, with many libraries available for developers. It's an old language, and it's been heavily used/tested in the past, so everything you want to do has probably already been done to some degree.
Make sure you use erlang version R11B5 or newer! Earlier versions of erlang did not provide the ability to timeout tcp sends. This results in stalled or malicious clients being able to execute a DoS attack on your application by refusing to recv data you send them, thus locking up the sending process.
See issue OTP-6684 from R11B5's release notes.
With Erlang the scalability and reliability is there but from your project definition you don't outline what type of text processing you will need.
I think Erlang's main limitation might be finding experienced developers in your area. Do some research on the availability of Erlang architects and coders.
If you are going to teach yourself or have your developers learn it on the job keep in mind that it is a very different way of coding and that while the core documentation is good a lot of people do wish there were more examples. Of course the very active community easily makes up for that.
I understand Erlang's text processing
capabilities might leave something to
be desired.
The starling project already provides basic unicode support and there is a EEP (Erlang Enhancement Proposal) currently in draft, but going in to bring it into the mainstream of Erlang/OTP support.
I encountered some problems with Redis read performance from Erlang. Here is my question. I tend to think the reason is Erlang-written module, which has troubles while processing tons of strings during communication with Redis.

Resources