Red Hat AMQ 6
As of February 2025, Red Hat is no longer supporting Red Hat AMQ 6. If you are using AMQ 6, please upgrade: Migrating to AMQ 7.Este contenido no está disponible en el idioma seleccionado.
Chapter 5. Managing Slow Consumers
Overview Copiar enlaceEnlace copiado en el portapapeles!
- limiting the number of messages retained for a consumerWhen using non-durable topics, you can specify the number of messages that a destination will hold for a consumer. Once the limit is reached, older messages are discarded when new messages arrive.
- aborting slow consumersJBoss A-MQ determines slowness by monitoring how often a consumer's dispatch buffer is full. You can specify that consistently slow consumers be aborted by closing its connection to the broker.
Limiting message retention Copiar enlaceEnlace copiado en el portapapeles!
pendingMessageLimitStrategy
) on a topic to control the number of messages that are held for slow consumers. When set, the topic will retain the specified number of messages in addition to the consumer's prefetch limit.
1000
, which means that the topic retains the newest 1000 unconsumed messages for a consumer. .
- specifying a constant number of messages over the prefetch limitThe
constantPendingMessageLimitStrategy
implementation allows you to specify constant number of messages to retain as shown in Example 5.1, “Constant Pending Message Limiter”.Example 5.1. Constant Pending Message Limiter
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - specifying a multiplier that is applied to the prefetch limitThe
prefetchRatePendingMessageLimitStrategy
implementation allows you to specify a multiplier that is applied to the prefect limit. Example 5.2, “Prefetch Limit Based Pending Message Limiter” shown configuration that retains twice the prefect limit. So if the prefect limit is 3, the destination will retain 6 pending messages for each consumer.Example 5.2. Prefetch Limit Based Pending Message Limiter
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Handling advisory topics for a broker network Copiar enlaceEnlace copiado en el portapapeles!
Example 5.3. Configuration for advisory topics
constantPendingMessageLimitStrategy
limit value based on your application requirements.
constantPendingMessageLimitStrategy
, go to http://activemq.apache.org/slow-consumer-handling.html
Aborting slow consumers Copiar enlaceEnlace copiado en el portapapeles!
- a consumer is considered slow for specified amount of time
- a consumer is considered slow a specified number of times
Example 5.4. Aborting Slow Consumers
abortSlowConsumerStrategy
element activates the abort slow consumer strategy with default settings. Consumers that are considered slow for more than 30 seconds are aborted. You can modify when slow consumers are aborted using the attributes described in Table 5.1, “Settings for Abort Slow Consumer Strategy”.
Attribute | Default | Description |
---|---|---|
maxSlowCount | -1 | Specifies the number of times a consumer can be considered slow before it is aborted. -1 specifies that a consumer can be considered slow an infinite number of times. |
maxSlowDuration | 30000 | Specifies the maximum amount of time, in milliseconds, that a consumer can be continuously slow before it is aborted. |
checkPeriod | 30000 | Specifies, in milliseconds, the time between checks for slow consumers. |
abortConnection | false | Specifies whether the broker forces the consumer connection to close. The default value specifies that the broker will send a message to the consumer requesting it to close its connection. true specifies that the broker will automatically close the consumer's connection. |
Example 5.5. Aborting Repeatedly Slow Consumers
<abortSlowConsumerStrategy maxSlowCount="30" />
<abortSlowConsumerStrategy maxSlowCount="30" />