Specifying active and failover jms connection through axis2 xml - java

I have a jms based webservice implemented in axis2 framework. It uses Tibco EMS for JMS queue and connection factory.
Currently I have defined the active EMS server connection in axis2.xml and works fine. However, if this server goes down for some reason, I need to update the ais2.xml manually to point to failover EMS server and then bounce my webservice.
How can I define both active and failover connection such that it switches automatically when active one goes down
Regards,
Rajesh

In TIBCO EMS you can define an FT URL using the following syntax :
tcp://server:port,tcp://server:port
For example :
tcp://server1:7222,tcp://server2:7222
I think you should be able to use such connection URL in your framework.

Related

IBM MQ - Message Listener create 2 connections by default

Developed a Spring Boot Application, which comprises of JMS Message Listener which is listening the JMS Queue. Before starting of the Spring Boot Application, the connection usage in the IBM MQ Server is 24. After starting up the Spring boot application, connection size is incremented to 26, that is 2 connection is created. But I was expecting only one connection has to be created in this case. PSB the connection details
DEV.APP.SVRCONN,,127.0.0.1,,,,,,,NONE,IBM MQ Channel,jmslistener-1.0-SNAPSHOT.jar
DEV.APP.SVRCONN,,127.0.0.1,,,,,REQ_QUEUE_A,QUEUE,ACTIVE,IBM MQ Channel,jmslistener-1.0-SNAPSHOT.jar
Seems the first connection is created for connecting to MQ Channel. I wasn't sure, whether this is the expected behaviour. Can anyone help me to understand on the connection creation and usage pattern in IBM MQ?
Each JMS "Connection" and each JMS "Session" correspond to a separate MQ Connection. So a simple JMS listener (usually 1 connection+1 session) is likely to result in 2 MQ connections as you've seen.

Connecting and sending message between Spring WebSocket instances

I have multiple instances using Spring Boot WebSocket (created following the first half of Spring's guide). I need them to connect to other instances at specific hostnames and ports and to be able to send messages over the websocket connection using STOMP protocol.
How can I connect to my other services over websocket?
How can I send messages using the STOMP protocol (preferably using the same marshalling/unmarshalling magic I get with received messages)?
Things that don't answer my question:
I have read Spring: send message to websocket clients and Sending message to specific user on Spring Websocket but these and other questions seem to all assume that a client has already initiated a connection and that there are users and topics established. This is not my use case as my services are both server AND client.
I am not using a cluster and I am not sharing sessions across instances as in Spring Websocket in a tomcat cluster
I have found some resources that cast some light on how to accomplish this:
http://www.baeldung.com/websockets-api-java-spring-client
https://www.sitepoint.com/implementing-spring-websocket-server-and-client/#javaspringchatclient
http://useof.org/java-open-source/org.springframework.messaging.simp.stomp.StompSessionHandler
number 3 is at least a complete implementation but is unfortunately devoid of comments to explain what's going on.

Configuration for Spring stomp multi-application server

I'm developing a realtime notification system in Spring 4 by using a build-in Message Broker, and STOMP over WebSocket.
I would like to handle a case when there is a multi-application server and user destination is unresolved (because user is connected to another server). Spring docs claim there is a solution:
In a multi-application server scenario a user destination may remain
unresolved because the user is connected to a different server. In
such cases you can configure a destination to broadcast unresolved
messages to so that other servers have a chance to try. This can be
done through the userDestinationBroadcast property of the
MessageBrokerRegistry in Java config and the
user-destination-broadcast attribute of the message-broker element in
XML.
But there is no example of such configuration. How can I set servers to recieve these messages and authentification parameters for system channel?
When dealing with multi-node applications using WebSockets over STOMP you must configure and use an external STOMP Broker (such as RabbitMQ) so that different application instances can communicate each other. Are you already doing it, right?
In order to configure the userDestinationBroadcast and the userRegistryBroadcast just assign a destination name to them. When the application starts and the system TCP connection between the app and the broker is established, these destinations will be automatically created and everything will work fine and transparently.
I've coded a Web Chat app using Spring WebSockets, RabbitMQ and much more and its configuration is available here.
I hope this helps.

How to make sure that my Application connection to RabbitMQ is healthy?

I am required to set up a keepalive endpoint to my web application (tomcat war).
The endpoint will be sampled periodically by my WAF to make sure that the app is healthy.
A healthy app means that the application is up and the communication to the RabbitMQ server (version 3.5.3 /spring-rabbit 1.4.5) is up and functional.
I will open some REST API to my WAF that will verify the connection status.
Reading the documentation I am quite lost on how to implement this functionally.
I noticed some functionality that may help, but I am not sure:
Enable automatic recovery and use RecoveryListener and make sure that the last recovery did not fail.
Configure HeartBeat and figure out a way to be notified on “disrupted connections”
Create some Heath Queue and use a plugin like Shovel to echo back the message, if I do not get any response I assume the queue is down
You don't need anything special like shovel to implement a health check. Just create a health queue and send/receive to/from it.
If you are using Spring AMQP
rabbitTemplate.send("", "healthQueue", "foo");
String foo = rabbitTemplate.receive("healthQueue");
In addition, you can register a ConnectionListener with Spring AMQP's connection factory and you will be notified when the connection is created/closed.
Spring AMQP has had connection recovery from the beginning so the (relatively new) built-in auto recovery in the rabbitmq client is not used.
If you are not using Spring AMQP use basicPublish and basicGet on a channel to send/receive to/from a health queue.

To whom does the consumer send acknowledgement for client acknolwedgement mode in JMS

When we use a client acknowledgement mode in JMS (I am using Websphere MQ and WAS), the MDB sends the acknowledgement to whom (the docs say to the JMS server).
But in this case, the JMS server means what: the WebSphere MQ which actually has all the queues and the messages or the web sphere application server that is connecting to the websphere MQ.
Acknowledgements, no matter the type, are always sent to the JMS server. Message producers and consumers never communicate directly due to the asynchronous nature of JMS.
Are you using connection factories to obtain a connection? If so, look at the broker url configuration in those factories. You should find the connection url points to WSMQ brokers. So, when you get a connection from a connection factory, the client connection goes directly to the JMS server in WSMQ.

Categories