Try setting you prefetch size down to 1, see:
http://goopen.org/confluence/display/ACTIVEMQ/What+is+the+prefetch+limit+for
Or disable optimized acknowledge. See:
http://goopen.org/confluence/display/ACTIVEMQ/Optimized+Acknowledgement
On 5/10/06, Keith Irwin <keith.irwin@gmail.com> wrote:
> Folks--
>
> I've got a bunch of client processes which listen on some topics, send
> to others. When I take one of the clients down, then start it back
> up, I suddenly get a bunch of messages I've already seen. Even though
> I use durable subscriptions and persistent messages, this shouldn't be
> so, should it?
>
> Details:
>
> For the topics listened to, I use a durable subscription, something like this:
>
> ... // listening
>
> String topicName = "bar";
> String listenerName = "foo";
> String clientId = "foo.bar";
> String subscriberName = "foo.bar";
>
> this.connect = factory.createTopicConnection();
> this.connect.setClientID(clientId);
> this.session = connect.createTopicSession(false,
> Session.AUTO_ACKNOWLEDGE);
>
> this.subscriber = session.createDurableSubscriber(this.topic,
> subscriberName);
> this.subscriber.setMessageListener(this);
>
> this.connect.start();
>
> --- // sending init
>
> this.connect = factory.createTopicConnection();
> this.session = connect.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
> this.topic = (Topic)jndi.lookup(this.topicName);
> this.publisher = this.session.createPublisher(this.topic);
> this.connect.start();
>
> --- // sending
>
> TextMessage textMessage = this.session.createTextMessage();
> textMessage.setText("stuff");
> testMessage.setStringProperty("something", "other");
> textMessage.setJMSPriority(Message.DEFAULT_PRIORITY);
> textMessage.setJMSDeliveryMode(DeliveryMode.PERSISTENT);
> textMessage.setJMSExpiration(TIME_TO_LIVE);
> this.publisher.send(textMessage);
>
> ---
>
>
> And so on and so on. Basically, I use a client name + the topic name
> as a "unique" client id and a unique subscriber name.
>
> So far so good. All of this worked with OpenJMS as I'd expect (except
> I had to write my own failover stuff in case openjms went down).
>
> When I run a test, everything works exactly as I expect it should.
>
> BUT, if I take out one of the components, then start it up again, that
> component gets a bunch of messages it's already seen!
>
> ALSO, if I shut down activemq itself, then start it back up again, a
> bunch of messages get, as far as I can tell, resent!
>
> Why is this so? I'd expect that if all messages are delivered and I
> take down a client component to, say, install a new version, I should
> be able to bring it up without it getting a slew of new messages.
>
> Has anyone else seen this? Perhaps a teensy little setting or api fixes this?
>
> Keith
>
--
Regards,
Hiram
|