GitHub user pxd98 added a comment to the discussion: QuickStart Demo ERROR:
Task was cancelled.
是不是因为你的broker在windows机器上跑的。
producer或者proxy发送消息的步骤简单可以分为两步,第一步是去nameserver获取这个topic的路由信息,第二步是往路由信息中拿到的broker地址直接发送。这个broker的地址在不设置的情况下是这里代码
(remoting/src/main/java/org/apache/rocketmq/remoting/common/RemotingUtil.java)实现的:
```
public static String getLocalAddress() {
try {
// Traversal Network interface to get the first non-loopback and
non-private address
Enumeration<NetworkInterface> enumeration =
NetworkInterface.getNetworkInterfaces();
ArrayList<String> ipv4Result = new ArrayList<String>();
ArrayList<String> ipv6Result = new ArrayList<String>();
while (enumeration.hasMoreElements()) {
final NetworkInterface networkInterface =
enumeration.nextElement();
if (isBridge(networkInterface)) {
continue;
}
final Enumeration<InetAddress> en =
networkInterface.getInetAddresses();
while (en.hasMoreElements()) {
final InetAddress address = en.nextElement();
if (!address.isLoopbackAddress()) {
if (address instanceof Inet6Address) {
ipv6Result.add(normalizeHostAddress(address));
} else {
ipv4Result.add(normalizeHostAddress(address));
}
}
}
}
// prefer ipv4
if (!ipv4Result.isEmpty()) {
for (String ip : ipv4Result) {
if (ip.startsWith("127.0") || ip.startsWith("192.168")) {
continue;
}
return ip;
}
return ipv4Result.get(ipv4Result.size() - 1);
} else if (!ipv6Result.isEmpty()) {
return ipv6Result.get(0);
}
//If failed to find,fall back to localhost
final InetAddress localHost = InetAddress.getLocalHost();
return normalizeHostAddress(localHost);
} catch (Exception e) {
log.error("Failed to obtain local address", e);
}
return null;
}
```
这个在多网卡和windows机器上好像有点问题。所以建议你手动在broker.conf里设置brokerIP1,然后你在proxy的机器上telnet这个地址和broker的端口,只要能通应该就没问题了。
你要排查原因的话也可以,就是在proxy这里打印出来你的消息发送的broker地址,理论上你这个错误,那么这个地址是不通的。
GitHub link:
https://github.com/apache/rocketmq/discussions/7528#discussioncomment-8783169
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]