2016-09-12 9 views
1

多くのメッセージが処理された後、私のSpring 4 JMSアプリケーションを動的にスケールダウンしようとしています。私は現在、コンシューマシップが1-3のコンシューマを持っており、コンシューマが最大コンシューマに向かって成功するのを見ることができますが、コンシューマが作成されるとすぐに消えません。彼らはWAIT状態にとどまっています。私は負荷が沈静化した後に消費者をシャットダウンすることができる設定または構成があるかどうかを知りたい。誰か知っていますか?DefaultJmsListenerContainerFactory/DefaultMessageListenerContainer動的スケーリング:どのように機能しますか?

おかげで、

フアン

答えて

1

は、このオプションを見てみましょう:

/** 
* Specify the limit for idle executions of a consumer task, not having 
* received any message within its execution. If this limit is reached, 
* the task will shut down and leave receiving to other executing tasks. 
* <p>The default is 1, closing idle resources early once a task didn't 
* receive a message. This applies to dynamic scheduling only; see the 
* {@link #setMaxConcurrentConsumers "maxConcurrentConsumers"} setting. 
* The minimum number of consumers 
* (see {@link #setConcurrentConsumers "concurrentConsumers"}) 
* will be kept around until shutdown in any case. 
* <p>Within each task execution, a number of message reception attempts 
* (according to the "maxMessagesPerTask" setting) will each wait for an incoming 
* message (according to the "receiveTimeout" setting). If all of those receive 
* attempts in a given task return without a message, the task is considered 
* idle with respect to received messages. Such a task may still be rescheduled; 
* however, once it reached the specified "idleTaskExecutionLimit", it will 
* shut down (in case of dynamic scaling). 
* <p>Raise this limit if you encounter too frequent scaling up and down. 
* With this limit being higher, an idle consumer will be kept around longer, 
* avoiding the restart of a consumer once a new load of messages comes in. 
* Alternatively, specify a higher "maxMessagesPerTask" and/or "receiveTimeout" value, 
* which will also lead to idle consumers being kept around for a longer time 
* (while also increasing the average execution time of each scheduled task). 
* <p><b>This setting can be modified at runtime, for example through JMX.</b> 
* @see #setMaxMessagesPerTask 
* @see #setReceiveTimeout 
*/ 
public void setIdleTaskExecutionLimit(int idleTaskExecutionLimit) { 

また、あなたは彼らのJavaDocを経由してDefaultMessageListenerContainerの他のすべてのオプションを検討することができます。

+0

私はこれを読んで、タスクごとに最大のメッセージを受信し、タイムアウトのドキュメントを受け取っています。さらに、デフォルトのJMSリスナーコンテナファクトリでそのプロパティをどのように設定できるかはわかりません。人々がデフォルトのJMSリスナーコンテナファクトリでどのように動作しているのかを知りたい。 – jcb

+0

これらのオプションは 'DefaultJmsListenerContainerFactory'には公開されませんが、常に' initializeContainer(DefaultMessageListenerContainer) 'オーバーライドを介して委譲ロジックを実装することができます。 –

+0

これは素晴らしいオプションです、ありがとう! – jcb

関連する問題