is it possible to set a heartbeat or keep-alive for a JMS consumer using QPID JMS? I've found some configuration of QPID which can bet set at the URL like an idleTimeout but I've not found an option to send empty frames for a limited time period.
Regards
The Qpid JMS client allows you to configure how long the idle timeout is which controls when the client will consider the remote to have failed should there be no traffic coming from the remote either in the form of messages or possibly as empty frames in order to keep the connection from idling out. The client will itself respond the the remote peer's requested idle timeout interval by sending as needed an empty frame to ensure that the remote doesn't drop the connection due to inactivity.
If you are seeing drops in connections due to idle timeout on a server then it is likely you have not configured the server to provide an Idle timeout value in the Open performative that it sends to the client.
Reading the specification section on Idle Timeout of a Connection can shed some light on how this works.
Related
We are using STOMP over WebSockets (ref) into ActiveMQ 5.15.
With this we are defining a client (to server) heartbeat of 20 seconds. The notification of this time is built into the STOMP protocol so communicated to the server.
CONNECTED server:ActiveMQ/5.15 heart-beat:0,20000 session:ID:app.server.mycompany.com-43039-1617089631808-3:3585 version:1.1
The client heartbeat code depends on browser setInterval() and this doesn't appear fully reliable so occassionally the heartbeat doesn't get sent and the server then ends up killing the connection.
Transport Connection to: ws://10.x.x.x:50670 failed: org.apache.activemq.transport.InactivityIOException: Channel was inactive for too (>20000) long:
I have noticed that there is a transport.hbGracePeriodMultiplier setting on pure Stomp connector in ActiveMQ however the Stomp over WS client connects in on ActiveMQ WebSocket connector.
My question is: is there an equivalent grace period setting for WebSockets?
We want to use spring websockets + STOMP + amazon MQ as a full featured message broker. We were trying to do benchmarking, to find out how many client websocket connections single tomcat node can handle. But it appears that we hit amazonMQ connection limit first. As per the aws documentation, amazonMQ has a limit of 1000 connections per node (as far as I understand we can ask support to increase the limit, but I doubt that it can be increased big time). So my questions is:
1) Am I correct in assuming that for every websocket connection from client to spring/tomcat server, a corresponding connection being opened from server to broker? Is this correct behavior or we're doning something wrong here/missing something?
2) What can be done here? I mean I don't think this is a good idea to create broker node per evry 1000 users..
According to https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/messaging/simp/stomp/StompBrokerRelayMessageHandler.html your are doing everything right, and it is documented behavior.
Quote from javadoc:
For each new CONNECT message, an independent TCP connection to the broker is opened and used exclusively for all messages from the client that originated the CONNECT message. Messages from the same client are identified through the session id message header. Reversely, when the STOMP broker sends messages back on the TCP connection, those messages are enriched with the session id of the client and sent back downstream through the MessageChannel provided to the constructor.
As for a fix, you can write your own message broker relay, with tcp connection pooling.
We are developing a solution using TIBCO-EMS, and we have a question about its behaviour.
When using CLIENT_ACKNOWLEDGE mode to connect, the client acknowledges the received message. We'd like to know for how long does TIBCO wait for acknowledgement, and if this time is configurable by the system admin.
By default, the EMS server waits forever for the acknowledgement of the message.
As long as the session is still alive, the transaction will not be discarded and the server waits for an acknowledgement or rollback.
There is however a setting within the server disconnect_non_acking_consumers where the client will be disconnected, if there are more pending messages (not acknowledged) then the queue limit does allow to store (maxbytes, maxmsgs). In this case, the server sends a connection reset to get rid of the client.
Sadly the documentation doesn't state this explicitly and the only public record I found was a knowledge base entry: https://support.tibco.com/s/article/Tibco-KnowledgeArticle-Article-33925
as I understand, there is an inactivity time-out in AMQP protocol. It's set to 15 minutes in Azure Service Bus.
Is it possible to change that time-out? OperationTimeout is ignored in case of AMQP protocol.
The inactivity timeout in AMQP protocol is called idle-timeout of a connection. Most, if not all, client libraries support this property. The Azure Service Bus sets this value to 4 minutes. This cannot be changed but a client can set its own idle-timeout to make the service send heartbeats during idle time. If allowed by the library, the application may also overwrite the idle timer interval to send heartbeats more often.
The 15 minute timeout you mentioned seems to be the entity idle timeout. This is Service Bus specific behavior. If an entity (queue or topic) has no activity for a pre-defined time window, the entity is unloaded (meaning all protocol connections are closed). This value cannot be changed. The only way to keep the entity active is by sending messages over the sending link, or keeping an outstanding credit on the receiving link.
One of my app need socket connection.
I tested on nitrous.io, but their free account always close the socket connection if there is no signal between server and client more than 1 minute.
Just wonder if there is similar socket connection limitation on heroku?
Your comment welcome
Heroku has support for WebSockets, with the usual 30s timeout limitation. This can be easily worked-around by sending heartbeat packets.
https://devcenter.heroku.com/articles/heroku-labs-websockets