i am using ActiveMQ as message broker and used Qpid proton c library to connect to Erlang for messaging service and seems working well with below commands with ActiveMQ running.
qpidpn:subscribe("amqp://127.0.0.1/topic://destination").
qpidpn:publish(#{address => "amqp://127.0.0.1/topic://destination", body => "hello"}).
flush().
qpidpn:stop().
q().
I need to write a module in elixir to connect to the ActiveMQ broker same as done in erlang above.
Erlang is though connected to message broker service using qpid library. Please suggest.
I haven't tried out the code below but calling an Erlang lib from Elixir is pretty trivial.
Try this:
:qpidpn.subscribe("amqp://127.0.0.1/topic://destination")
:qpidpn.publish(%{:address => "amqp://127.0.0.1/topic://destination", :body => "hello"})
:flush()
:qpidpn.stop()
:q()
As I say, I haven't tried it (and can't because I don't have amqp or qpidn installed) but that may be along the lines of what you're looking for.
Related
I am trying to start my Eclipse Mosquitto broker service for listening to websockets adding:
listener 8083
protocol websockets
at the mosquitto.conf
If I only use listener 8083, the service starts but when protocol websockets is added, the service stops and refuses to start.
The error I get if I run:
mosquitto -v -c mosquitto.conf
is: 1588309602: Error: Unable to start any listening sockets, exiting.
The full output is:
1588309602: mosquitto version 1.6.9 starting
1588309602: Config loaded from mosquitto.conf.
1588309602: Opening websockets listen socket on port 8083.
1588309602: Error: Unable to start any listening sockets, exiting.
I am under Windows10 Pro.
Any ideas?
The answer to this:
Based on trials I can confirm that you need to mention a default port initially e.g.
port 1883
protocol mqtt
# Websockets
listener 9001
protocol websockets
if you only wish to use WebSockets for MQTT then instead of using listener 9001 you need to replace it with port 9001.
There should be atleast one default port to listen to in Mosquitto MQTT.
Verified using Mosquitto 1.6.10
I am posting an answer based on facts.
I have uninstalled version 1.6.9 and installed 1.6.7 and now the service is running using websockets...
I cannot confirm if this is an issue with 1.6.9 but this is what happened to me.
BR
According to other sources, the error lies in 1.6.10 (and perhaps others), whereby, there MUST be a standard protocol mqtt defined, otherwise websockets will not start.
Thus you can leave the standard configuration alone (port 1883) and then in the
Extra listeners section of mosquitto.conf, define the websockets listener as you like.
I believe this has been remedied in later versions, so that only websockets can be defined.
Sadly, in this case the only defense against unauthorized use of the broker over the standard mqtt socket is then the system firewall for external users. Users with ssh access can "play".
The mqtt protocol has to be enabled for the websockets to work.
As the option port (like others have mentioned) is deprecated in versions 2.x.x, you can use listener instead.
listener 1883
protocol mqtt
listener 9001
protocol websockets
And then run your mosquitto server as usual.
I'm writing a producer in go, using the channel producer example of confluent-kafka-go library. When I run my app with brokers working then I get the produced events by reading from range producer.Events() .
But when the brokers are down, I get logs like the following from the kafka library printed in stderr, but I cannot find a way for my app to register for those errors so I can detect them:
%3|1528267290.204|FAIL|rdkafka#producer-1| [thrd:xxx.xxx.com:9092/bootstrap]: xxx.xxx.com:9092/bootstrap: Connect to ipv4#xxx.xxx.xxx.xxx:9092 failed: Connection refused
%3|1528267290.204|ERROR|rdkafka#producer-1| [thrd:xxx.xxx.com:9092/bootstrap]: 1/1 brokers are down
How can I receive those events from the library ? To clarify I'm interested in errors like RD_KAFKA_RESP_ERR__FAIL described in the docs
It seems there was no way to receive the errors, I have opened an issue and the fix will be released soon in v0.11.5:
https://github.com/confluentinc/confluent-kafka-go/issues/200
Hi good people of StackOverflow.
I am having issues with EventMachine.connect, I am able to specify host name and port but not sent additional params in my connection string.
Here is my code:
EM.connect 'localhost', 61613, StompListener
Now I am experiencing issues with STOMP connection to ActiveMQ server, basically, connection keeps dying from time to time and I need to reconnect. I have found following info where Apache ActiveMQ suggests
using transport.keepAlive=true for these cases. But I am not able to figure out how to add this URL params to EM.connect, do you know how?
Following the wiki page https://cwiki.apache.org/qpid/amqp-java-jms-messaging-client.html to https://cwiki.apache.org/qpid/connection-url-format.html.
Simple me expected qpid-amqp-1-0-client-jms-0.20-sources.jar to accept the URI format, but it seems to disregard just about everything - especially the "brokerlist" option?
For example:
amqp://guest:guest#nowhere?brokerlist='tcp://localhost:5672;tcp://localhost:15672'&failover='roundrobin'
However the ConnectionFactory insist on using the <clientid> as broker host, and adds default port to it.
I'm sure I'm missing something really obvious here...
Broker is ActiveMQ 5.8.0, BTW.
Connection string you are using is pre-AMQP 1.0, new connection string should be of the following format without brokerlist
amqp://guest:guest#nowhere?remote-host=default
You are missing the virtual host in your url: amqp://guest:guest#clientid/host?
I'm running into a problem every two months or so. My activemq server dies and the log is full with SocketExceptions.
I have a PHP application using stomp to send messages to ActiveMQ and
a Java application to consume the messages.
I have activemq on another server where only java applications are used when sending/consuming messages and it has never failed like this. I think there is somthing
wrong with Stomp.
The stomp code is very basic and does not send anything odd. Only messages with message properties set. The stomp code closes the connection after every message sent.
I've looked at lsof and there is nothing out of order there.
netstat does however have alot of:
tcp6 0 0 127.0.0.1:61616 127.0.0.1:46280 CLOSE_WAIT
And the ActiveMQ Log shows alot of this
2011-04-28 12:43:09,819 | ERROR |
Could not accept connection :
java.net.SocketException: Too many
open files |
org.apache.activemq.broker.TransportConnector
| ActiveMQ Transport Server:
tcp://0.0.0.0:61616
I'm using:
ActiveMQ 5.4.2,
Tomcat 6.0.20,
Debian 5.0.3,
PHP 5.2.6,
Stomp revision 43
It seems that you are opening a lot connections in your java program, and then you are hitting your ulimit -n. Close Connections after usage or use a connection pool.
As a wourkaround you can raise your open file limit via sysctl, see a tutorial here.