Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot connect when client hostname changed #119

Open
jwh331 opened this issue Feb 5, 2020 · 0 comments
Open

Cannot connect when client hostname changed #119

jwh331 opened this issue Feb 5, 2020 · 0 comments

Comments

@jwh331
Copy link

jwh331 commented Feb 5, 2020

Hello, I need some help with mqtt connection.

I place an mqtt client(runnable jar) on host "A".
and set host "B" as apache activeMQ server.

If I send some test data A to B, It works fine.
But when I modify hostname A, mqtt client cannnot connect to host B.

ERROR LOG:

Exception in thread "main" java.util.concurrent.TimeoutException
at org.fusesource.mqtt.client.Promise.await(Promise.java:83)
at app.Main.main(Main.java:24)

Client codes are below:

String data = "...testdata...";
MQTT mqtt = new MQTT();
mqtt.setHost("host-B-Domain.com", 1883);
mqtt.setUserName("testUser");
mqtt.setPassword("testPwd");
mqtt.setWillRetain(false);

FutureConnection connection = mqtt.futureConnection();
connection.connect().await(5, TimeUnit.SECONDS);	**#connectionTimeout occurs**
connection.publish(
    new UTF8Buffer("testBufferData"), new AsciiBuffer(data), QoS.EXACTLY_ONCE, false);
connection.disconnect().await();

firewall config is OK and tested with telnet command.

I've also checked with tcpdump.
If hostname changed, mqtt does not send any packets to host B.
And activeMQ doesn't have any restrictions about hostname.

Both hosts are running with CentOS 7 x64.
And using java-1.8.0-openjdk-headless-1.8.0.91-1.b14.el7_2.x86_64.

How can I solve this issue?

any comments are appreciated.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant