Using Proxy setting to connect to Event Broker
I am using Java Client code to connect to event broker and need to know how to do Proxy setting in the code.
Tried below code for HOST but its not recognizing the below fromat and throwing "Too many colons in host" exception
tcps:solace.company.com%socks5://User:PassWord@proxy.company.com:13128
Best Answer
-
Correct @anandhanur, I was actually just navigating back to this thread in case others come across it. Per the docs
The use of proxies is supported by the Java RTO, C, and .NET messaging APIs, but not by JCSMP.
0
Answers
-
Hey @anandhanur - I am not sure i understand your question correctly, what exactly do you mean by proxy setting? And what are you trying to do with this (or what is your use case?)
0 -
Hi @anandhanur,
Your host looks correct to me per the docs. Which solace library are you using? Java, Java(JCSMP) or JMS?
@Tamimi check out "Connecting to Host Event Broker Through Proxies" on this docs page
1 -
Hi @Tamimi - Thank you for the quick reply!
i have created Event broker and want to publish some events .So I am using JCSMP API to write client EventPublisher code.With the sample code from solace website i am able to run and publish events from my local system which is cloud VDI.Now when i try to run this in onprem machine or machine which doesn't have internet connection,i am getting below error
"Exception in thread "main" com.solace.messaging.PubSubPlusClientException$ServiceUnreachableException: Service can't be reached using provided host and port"
So how to resolve this issue.
Can i set proxy server as part of the HOST configuration ( [Protocol:]Host[:Port][%ProxyService] ) as mentioned in Session Properties Required to Establish a Connection (solace.com) .
tcps:solace.company.com%socks5://User:PassWord@proxy.company.com:13128
—connect to an event broker atsolace.company.com
using SSL over TCP through a SOCKS5 proxy server atproxy.company.com
, port 13128. Authenticate with the proxy server using usernameUser
and passwordPassWord
.
Doing so i am getting "Too many colons in host" exception.So JCSMP API doesnt not accept the above HOST format.Any leads is much appreciated!
Meanwhile i am trying with JavaRTO API now..
0 -
Hi @marc -
I was trying with Java JCSMP API but document says proxy setting is supported only in Java RTO API so i am trying that now..If any fix or work around available for JCSMP is very useful as our team is more inclined towards using JCSMP API.
0 -
Correct @anandhanur, I was actually just navigating back to this thread in case others come across it. Per the docs
The use of proxies is supported by the Java RTO, C, and .NET messaging APIs, but not by JCSMP.
0 -
@marc session creation is failing while being in company VPN. so tried with proxy settings as well given in but no luck. I tried with multiple debug.
string host = $"tcp://mr-connection-l7ua5omxxxx.messaging.solace.cloud:55555%httpc://rb-proxy-de.bosch.com:8080";
string username = "solace-cloud-client";
string vpnname = "solace1sttryout";
string password = "pflxxxxxxxxxxxxxxxxxxxqp";SessionProperties sessionProps = new SessionProperties()
{
Host = host,
VPNName = VPNName,
UserName = UserName,
Password = Password,
ReconnectRetries = DefaultReconnectRetries,
SSLValidateCertificate = false,
//SSLClientCertificateFile = sslFile
};
// Connect to the Solace messaging router
Console.WriteLine("Connecting as {0}@{1} on {2}...", UserName, VPNName, host);
using (ISession session = context.CreateSession(sessionProps, null, null))
{
ReturnCode returnCode = session.Connect();
if (returnCode == ReturnCode.SOLCLIENT_OK)
{
Console.WriteLine("Session successfully connected.");
PublishMessage(session);
}
else
{
Console.WriteLine("Error connecting, return code: {0}", returnCode);
}
}tried with without proxy and with proxy both failed.
also tried but no luck.
string host = $"tcps://mr-connection-l7ua5omxxxx.messaging.solace.cloud:55433%httpc://rb-proxy-de.bosch.com:8080";
0 -
Hi @Tamimi we are having usecases wherein we are trying to connect with Java JCSMP API to connect to proxy but document says proxy setting is supported only in Java RTO API .If any fix or work around available for JCSMP is very useful do we have any update on if this is considered in your road map
0