Chapter 18. Command Buffering

As JBoss Messaging clients send commands to their servers they store each sent command in an in-memory buffer. In the case that connection failure occurs and the client subsequently reconnects to the same server or fails over onto a replica server, as part of the reconnection protocol the server informs the client during reconnection with the id of the last command it successfully received from that client.

If the client has sent more commands than were received before failover it can replay any sent commands from its buffer so that the client and server can reconcile their states.

The size of this buffer is configured by the ProducerWindowSize parameter, when the server has received ProducerWindowSize bytes of commands and processed them it will send back a command confirmation to the client, and the client can then free up space in the buffer.

If you are using JMS and you're using the JMS service on the server to load your JMS connection factory instances into JNDI then this parameter can be configured in jbm-jms.xml using the element producer-window-size a. If you're using JMS but not using JNDI then you can set these values directly on the JBossConnectionFactory instance using the appropriate setter method.

If you're using core you can set these values directly on the ClientSessionFactory instance using the appropriate setter method.

The send window is specified in bytes, and has a default value of 1MiB.

When the send buffer becomes full, any attempts to send more commands from the client will block until the client receives a confirmation from the server and clears out the buffer. Because of the blocking, the command buffer performs a type of flow control, preventing the client from overwhelming the server with commands.

Setting this parameter to -1 disables any flow control on sending.