activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Tully <gary.tu...@gmail.com>
Subject Re: client is blocked after sending 5082 messages
Date Thu, 02 Apr 2009 10:06:10 GMT
you are seeing producer flow control in
action<http://activemq.apache.org/producer-flow-control.html>.
The objective of producer flow control is to ensure that an entire
connection is not blocked when the memory limit of a destination is reached.
The broker and producer communicate to push back on the producer when the
memory limit is approaching. The memory limit defaults to 64m.

If producer flow control is disabled, (see the policy entry in the link
above) once the queue memory limit is reached and system memory limit is
reached, a queues messages will be spooled to disk and the memory will be
released for more messages, which will in turn get spooled to disk.


2009/4/2 sulong <sulong1984@gmail.com>

> Hi all,I am testing the activemq to learn how to use it. I write a simple
> single thread jms client to send 10000 messages, but it is blocked at the
> 5083rd message. I use:
>
> activemq 5.2
> jvm  1.5
> ubuntu 8.10
>
> and the program is simple :
>
>
> public class Sender {
>    public static void main(String[] args) {
>         ConnectionFactory cf = new ActiveMQConnectionFactory("tcp://
> 10.1.94.237:6000");
>         Connection conn = null;
>         Session s = null;
>         try {
>             conn = cf.createConnection();
>
>             s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
>             s.run();
>             MessageProducer sender =
> s.createProducer(s.createQueue("jms_test"));
>             for (int i = 0; i < 10000; i++) {
>                TextMessage tm = s.createTextMessage();
>                tm.setText(String.valueOf(i));
>                sender.send(tm);
>             }
>
>             System.out.println("Done.");
>         }catch (JMSException e) {
>             e.printStackTrace();
>         } finally {
>             if (conn != null) {
>                 try {
>                     conn.close();
>                 } catch (Exception e) {
>                     e.printStackTrace();
>                 }
>             }
>
>             if (s != null) {
>                 try {
>                     s.close();
>                 } catch (Exception e) {
>                     e.printStackTrace();
>                 }
>             }
>         }
>    }
> }
>
> anyone knows why it is blocked? Thanks
>



-- 
http://blog.garytully.com

Open Source SOA
http://FUSESource.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message