You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Jiri Daněk <jd...@redhat.com> on 2018/05/31 11:58:12 UTC

Re: How to simulate slow consumer?

Hi Xiao, you do not provide enough context to figure what may be wrong.

From what I've seen handleMessage(String) is a handler in Spring Boot? Is
it possible this method is running concurrently for every message you
receive, each instance in a separate thread, and therefore it seems as if
no sleep was done? If so, then maybe try to make the method *synchronized*
(synchronized public void...), that might be quick and dirty solution...

Another factor may be message prefetch. The client library you are using
will pull messages from the broker in batches by default, to improve
performance. You can set prefetch size, the maximal amount of messages
transferred to you in advance.
http://activemq.apache.org/what-is-the-prefetch-limit-for.html

On Tue, May 29, 2018 at 8:32 AM, 王晓 <xi...@shunwang.com> wrote:

> hi:
> i want to simulate slow consumer , code below  can’t achieve results ,
> please give me a hand. :)
>
>
> @Override
>
>     public void handleMessage(String disburseNo) {
>         logger.debug("开始处理流程:" + disburseNo);
> //        disburseInterfaceBo.disburse(disburseNo);
>         try {
>             HttpClientUtils.doGet("google.com<http://google.com>",null);
>             Thread.sleep(60000);
>         } catch (Exception e) {
>             logger.error("===异常",e);
>         }
>         logger.debug("流程处理结束:" + disburseNo);
>     }
>
>


-- 
Mit freundlichen Grüßen / Kind regards
Jiri Daněk
Messaging QA