Simple demo of communication between elixir
and ruby
applications via thrift
models using tackle
AMQP client.
Inside ruby-thrift
directory
Compile .thrift
file with:
thrift -r --gen rb thrift/models.thrift
Start consuming messages from elixir
app with:
bundle exec ruby lib/consume.rb
Send message to elixir
app with:
bundle exec ruby lib/send.rb
Inside the elixir-thrift
directory:
Run these commands like in any other elixir app:
mix deps.get
mix deps.compile
mix run --no-halt
This will enable you to receive messages.
For the sending, you'll need to add the following line to the code:
ElixirThrift.Sender.send
This can be added in the lib/elixir_thrift.ex
file. That means that only one
message will be sent, when the app is started. You can also add the line inside
the handle_message
function in the lib/elixir-thrift/receiver.ex
file. That
way, every time a message is received, a message will be sent to the ruby app.