ActiveMQ producer flow control with timeout

ActiveMQ producer flow control feature allows you to prevent overflowing the broker by slowing down fast producers. Thus far you had two options, the producer send() method will either wait until space becomes available, or fail if it’s configured through sendFailIfNoSpace property, like this:

<systemUsage>
 <systemUsage sendFailIfNoSpace="true">
   <memoryUsage>
     <memoryUsage limit="20 mb"/>
   </memoryUsage>
 </systemUsage>
</systemUsage>

For 5.3.1 version of the broker we added a third option. You can now configure the broker to do the producer flow control with timeout. If you configure <systemUsage> like this (using sendFailIfNoSpaceAfterTimeout property),

<systemUsage>
 <systemUsage sendFailIfNoSpaceAfterTimeout="3000">
   <memoryUsage>
     <memoryUsage limit="20 mb"/>
   </memoryUsage>
 </systemUsage>
</systemUsage>

the producer’s send() method will wait for space for 3 seconds and if it don’t get it, it will fail. This feature can be very useful if you don’t want your producers wait for the space for the unspecified amount of time.