问题
Using using SOCKS proxy or any other Proxy, is there any way to connect to amqp queue over SSL using org.apache.qpid.jms.JmsConnectionFactory for environments where direct internet access is not available or amqps connection port is blocked by firewall.
I have tried connecting to amqp queue over SSL using org.apache.qpid.jms.JmsConnectionFactory on environments where internet is available.It is working fine!!!
回答1:
Using the latest release of the Qpid JMS client (0.47.0 as of this answer) you can create your own Netty ProxyHandler instance that controls how the client connects through a proxy and configure it on the Connection Extensions as documented in the code here: the Factory exposes this via the setter for connection extensions. The test case for this feature shows some usages.
Supplier<ProxyHandler> proxyHandlerSupplier = () -> {
return new Socks5ProxyHandler(new InetSocketAddress("localhost", getPort()));
};
JmsConnectionFactory factory = new JmsConnectionFactory(remoteURI);
factory.setExtension(JmsConnectionExtensions.PROXY_HANDLER_SUPPLIER.toString(), (connection, remote) -> {
return proxyHandlerSupplier;
});
来源:https://stackoverflow.com/questions/58803510/how-to-create-connection-to-amqp-queue-over-ssl-using-socks-proxy-or-any-other-p