Search code examples
erlangqueueamqpmessageqpid

Qpid Erlang Module


I am newbie to erlang but managed to get the ActiveMQ talking to my erlang shell using qpid pronton c library as, which is working well and i am getting messages from queue itself on my erlang shell and vice versa.

qpidpn:subscribe("amqp://localhost/topic://xxx").
qpidpn:publish(#{address => "amqp://127.0.0.1/topic://xxx", body => "hello"}).

Now, i want to implement the same above stated code using .erl file with some function getting invoked everytime we have new message on the queue and i can take further action of returning the same to origin.


Solution

  • You can implement gen_server, as seems the messages are coming from some MQ. So, you can get the messages in handle_info. Once there you can do whatever you want to do with them.