You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Keith Irwin <ke...@gmail.com> on 2006/05/11 00:14:54 UTC
when is a delivered message delivered?
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
Re: when is a delivered message delivered?
Posted by Keith Irwin <ke...@gmail.com>.
On 5/11/06, Hiram Chirino <hi...@hiramchirino.com> wrote:
> Try setting you prefetch size down to 1, see:
> http://goopen.org/confluence/display/ACTIVEMQ/What+is+the+prefetch+limit+for
Interesting to know about.
> Or disable optimized acknowledge. See:
> http://goopen.org/confluence/display/ACTIVEMQ/Optimized+Acknowledgement
Interesting as well.
It seems, though, that updating to the latest snaphot pretty much
solved the problem of messages somehow magically being re-sent even
after they've been delivered. In RC2 messages seemed to get resent
even after five or ten minutes if, that is, I took down a client, then
brought it back up (closing and reopening a connection, I suppose).
Anyway, I'm very glad the SNAPSHOT fixed whatever it was. ;)
Keith
>
> On 5/10/06, Keith Irwin <ke...@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
>
Re: when is a delivered message delivered?
Posted by Hiram Chirino <hi...@hiramchirino.com>.
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 <ke...@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