开发者

Fault Tolerance JMS URL in Java

开发者 https://www.devze.com 2023-03-23 03:12 出处:网络
I am doing a JMS connectio开发者_如何学运维n using Java. The command I am using to establish connection is

I am doing a JMS connectio开发者_如何学运维n using Java. The command I am using to establish connection is

QueueConnectionFactory factory = 
  new com.tibco.tibjms.TibjmsQueueConnectionFactory(JMSserverUrl);

Where JMSServerUrl is the varible which stores my JMS URL.

Now the problem is that I need to add the fault tolerance URL i.e two different URL's. So can any one tell me how can I specify two URLs together in the above code sample such that if first URL is not accessible it should try connecting to the other URL.


Put all URLs in a single string with a comma between them.

new TibjmsQueueConnectionFactory("ssl://host01:20302,ssl://host02:20302");

Caution, I am a Tibco EMS newbie, but this seems to work, as evidenced by the error I can get ...

javax.jms.JMSSecurityException: Failed to connect to any server at:
ssl://host01:20302,ssl://host02:20302 
[Error: Can not initialize SSL client: no trusted certificates are set: 
url that returned this exception = SSL://host01:20302 ]


The .NET documentation for tibco(I know your using java) suggests that you can provide a comma delimited list of server URL's for messaging connections. Bear in mind that I don't have any real tibco experience, but this is a common way to handle initial connection fault tolerance(i.e. prior to establishing a connection and receiving information about the cluster, after which failover is typically handled by the connection). It may be worth a try. Another solution that I have seen to this problem is creating a virtual IP and handling fault tolerance at the Network Level.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号