You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by j0llyr0g3r <ti...@wincor-nixdorf.com> on 2008/04/29 18:49:27 UTC
How do i configure the http transport connector to use a proxy?
Hi folks,
after i have figured out this problem (will be updated in the AMQ
documentation soon):
http://www.nabble.com/Standard-http-connector-example-not-working--td16937377s2354.html
i am having a new problem:
How do i configure the http transport connector to use a proxy?
I looked into the source-code and found this:
-> package:
activemq-optional/src/main/java/org/apache/activemq/transport/http
-> Class HttpTransportSupport
There is:
private String proxyUser;
private String proxyPassword;
and in class:HttpClientTransport
there is:
protected HttpClient createHttpClient() {
HttpClient client = new HttpClient();
if (getProxyHost() != null) {
client.getHostConfiguration().setProxy(getProxyHost(),
getProxyPort());
}
return client;
}
So, obviously i can use a http-proxy with AMQ, but how?
First i thought via something like adding this
....?trace=true&proxyHost=sdoesmon&proxyPort=3128"
to the network connector:
<networkConnector name="outbound_http"
uri="static://(http://esf-proto-2:61617)?trace=true&proxyHost=sdoesmon&proxyPort=3128"
networkTTL="5"/>
But the broker simply ignores this?
I checked this using the latest amq stable release and squid.
The two brokers can communicate with each other over http, but they simply
ignore the proxy.
I set the debug level in both the brokers and squid to the highest value,
neither do i get errors nor is the proxy used at all.
What do i have to add to the http-connector to make this work?
--
View this message in context: http://www.nabble.com/How-do-i-configure-the-http-transport-connector-to-use-a-proxy--tp16964261s2354p16964261.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.
Re: How do i configure the http transport connector to use a proxy?
Posted by j0llyr0g3r <ti...@wincor-nixdorf.com>.
Hi folks,
i finally got it working like this:
Broker 1:
<transportConnectors>
<transportConnector name="inbound_openwire"
uri="tcp://localhost:61616"/>
<transportConnector name="inbound_http"
uri="http://0.0.0.0:61617"/>
</transportConnectors>
<networkConnectors>
<networkConnector name="outbound_http"
uri="static://(http://broker-2:61617?proxyHost=myProxy&proxyPort=3128)"
networkTTL="5"/>
</networkConnectors>
Broker 2:
<transportConnectors>
<transportConnector name="inbound_openwire"
uri="tcp://localhost:61616"/>
<transportConnector name="inbound_http"
uri="http://0.0.0.0:61617"/>
</transportConnectors>
<networkConnectors>
<networkConnector name="outbound_http"
uri="static://(http://broker-1:61617?proxyHost=myProxy&proxyPort=3128)"
networkTTL="5"/>
</networkConnectors>
Squid:
-> without authentication
Consumer:
ant consumer -Durl=tcp://broker-1:61616
Producer:
ant producer -Durl=tcp://broker-2:61616
If i stop the squid-proxy -> no messages are delivered anymore
If i restart the squid-proxy -> messages are delivered
So, i guess it works......
One last issue:
I can not pass parameters in the URI like:
?proxyHost=myProxy&proxyPort=3128
The broker gives me the following error on startup:
ERROR: java.lang.RuntimeException: Failed to execute start task. Reason:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line
56 in XML document from class path resource [activemq.xml] is invalid;
nested exception is org.xml.sax.SAXParseException: The reference to entity
"proxyPort" must end with the ';' delimiter.
java.lang.RuntimeException: Failed to execute start task. Reason:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line
56 in XML document from class path resource [activemq.xml] is invalid;
nested exception is org.xml.sax.SAXParseException: The reference to entity
"proxyPort" must end with the ';' delimiter.
at
org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:99)
at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:51)
at
org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:104)
at
org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:51)
at
org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.activemq.console.Main.runTaskClass(Main.java:222)
at org.apache.activemq.console.Main.main(Main.java:106)
Caused by:
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line
56 in XML document from class path resource [activemq.xml] is invalid;
nested exception is org.xml.sax.SAXParseException: The reference to entity
"proxyPort" must end with the ';' delimiter.
Instead i have to use:
?proxyHost=myProxy&*amp;proxyPort=3128
(Minus the "*" because the mailing-list won't show this part of the string.)
According to the Jira-entry here:
-> https://issues.apache.org/activemq/browse/AMQ-1099
this should not be necessary.
Any ideas?
--
View this message in context: http://www.nabble.com/How-do-i-configure-the-http-transport-connector-to-use-a-proxy--tp16964261s2354p17109982.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.