On 4/10/06, ErinO <[EMAIL PROTECTED]> wrote:
>
> hi,
>
> I run the example program ProducerTool.java/ConsumerTool.java with 4.0 RC1,
> I created a durable topic and used ProducerTool to send 10 messages to
> broker, then run ConsumerTool, but it couldn't receive any messages.
>
> I debug into the code, looks like in Topic.java:
> if (store != null && message.isPersistent() && !canOptimizeOutPersistence()
> )
> store.addMessage(context, message);
> ...
>
> private boolean canOptimizeOutPersistence() {
> return durableSubcribers.size()==0;
> }
>
> As the broker is new, there is no durable subscriber, none of the message
> get added to message store, that is why when running ConsumerTool.java, it
> couldn't receive any messages. If I restart broker, all those durable
> messages will get lost.
>
> Is this a known issue?
Its an optimisiation; if we know there are no durable subscribers for
a topic we can optimise away the need to persist it. If you always
want to persist topic messages irrespective of if there are any
consumers we could enable that via a configuration flag
--
James
-------
http://radio.weblogs.com/0112098/