You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by "SebastianR." <Se...@de-gmbh.com> on 2008/08/19 13:12:25 UTC

Why don't Commit() and Receive() throw exceptions ? (NMS)

Hello,

i recognized that neither the ISession.Commit()- nor the
IMessageConsumer.Receive()-method throw any exceptions when called although
there is no connection established. I debugged a little into the
ActiveMQ.NMS namespaces and they actually realize that the connection is
broken (TcpTransport.cs, ll. 105 ff.), but neither throw an exception nor
trigger the Exceptionlistener (this is because the ResponseRequired flag is
"false" (l. 121)).

My basic setup is:   - ActiveMQ 4.1.1
                           - External Broker (also 4.1.1)
                           - NMS 4.1.1
                           - Autoacknowledged session for sending
                           - Transacted session for receiving

I knowingly not use the Exceptionlistener built in NMS, therefore the
application doesn't know when the connection brakes down (achieved through
pulling network plug). This leads to fully usable ActiveMQ/NMS objects, but
they are not throwing exceptions (testet only above methods).

Furthermore I realized that allthough there is no physical connection
anymore, the application still receives messages. Is there a kind of loacal
store/cache on each client ?

Regards, Sebastian


 
-- 
View this message in context: http://www.nabble.com/Why-don%27t-Commit%28%29-and-Receive%28%29-throw-exceptions---%28NMS%29-tp19048072p19048072.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Why don't Commit() and Receive() throw exceptions ? (NMS)

Posted by Jim Gomes <e....@gmail.com>.
Hi Sebastian,

The URI settings are not identical between the JMS provider and NMS.  Even
the different JMS providers (ActiveMQ, TIBCO, MSMQ) have specific URI
parameters.

Currently, the documentation is a bit behind on which URI parameters are
available for the separate provider implementations.  I plan on updating
them soon, but it might be a good idea to log a separate JIRA for
documenting these so that it doesn't get lost.

Thanks for logging the JIRA on the preFetch issue.

- Jim

On Fri, Aug 22, 2008 at 12:11 AM, SebastianR.
<Se...@de-gmbh.com>wrote:

>
>
> semog wrote:
> >
> > Hi Sebastian,
> >
> > You can set the prefetch size on the connection URI as follows:
> >
> > activemq:tcp://servername:61616?session.prefetchSize=5
> >
> > As you noted, the prefetch size is set to 1000 as a default, but it can
> be
> > changed on a per-connection basis.  Setting the value to 0 would
> > effectively
> > disable prefetch.
> >
> > As far as the issue with Commit not throwing an exception, I haven't had
> a
> > chance to look in to that.  If you like, you can enter a JIRA with the
> > information regarding current behavior and expected behavior so that it
> > can
> > be scheduled to be fixed in the product.
> >
> >
>
> First of all: Setting the prefetchSize with this URI-command in principle
> works.
>
> BUT, settting the prefetchSize to zero leads to the fact that no messages
> can be received anymore. I think this is because correctly no messages are
> dispatced anymore ( I varified this via JMX ), but the receive() methods
> still look at the local cache somhow, which of course is now always emtpy.
>
> I'll also make a JIRA for fixing this problem.
>
> One last question: Where can I myself find out which properties can be
> changed via URI-configuration ? I knew that in ActiveMQ for Java you can
> set
> the prefetchSize via ?jms.prefetchPolicy.all=50,
> ?jms.prefetchPolicy.queuePrefetch=1 or ?consumer.prefetchSize=10, but
> neither of them worked in NMS.
>
> Regards, Sebastian
> --
> View this message in context:
> http://www.nabble.com/Why-don%27t-Commit%28%29-and-Receive%28%29-throw-exceptions---%28NMS%29-tp19048072p19102512.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

Re: Why don't Commit() and Receive() throw exceptions ? (NMS)

Posted by "SebastianR." <Se...@de-gmbh.com>.

semog wrote:
> 
> Hi Sebastian,
> 
> You can set the prefetch size on the connection URI as follows:
> 
> activemq:tcp://servername:61616?session.prefetchSize=5
> 
> As you noted, the prefetch size is set to 1000 as a default, but it can be
> changed on a per-connection basis.  Setting the value to 0 would
> effectively
> disable prefetch.
> 
> As far as the issue with Commit not throwing an exception, I haven't had a
> chance to look in to that.  If you like, you can enter a JIRA with the
> information regarding current behavior and expected behavior so that it
> can
> be scheduled to be fixed in the product.
> 
> 

First of all: Setting the prefetchSize with this URI-command in principle
works. 

BUT, settting the prefetchSize to zero leads to the fact that no messages
can be received anymore. I think this is because correctly no messages are
dispatced anymore ( I varified this via JMX ), but the receive() methods
still look at the local cache somhow, which of course is now always emtpy.

I'll also make a JIRA for fixing this problem.

One last question: Where can I myself find out which properties can be
changed via URI-configuration ? I knew that in ActiveMQ for Java you can set
the prefetchSize via ?jms.prefetchPolicy.all=50,
?jms.prefetchPolicy.queuePrefetch=1 or ?consumer.prefetchSize=10, but
neither of them worked in NMS.

Regards, Sebastian
-- 
View this message in context: http://www.nabble.com/Why-don%27t-Commit%28%29-and-Receive%28%29-throw-exceptions---%28NMS%29-tp19048072p19102512.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Why don't Commit() and Receive() throw exceptions ? (NMS)

Posted by Jim Gomes <e....@gmail.com>.
Hi Sebastian,

You can set the prefetch size on the connection URI as follows:

activemq:tcp://servername:61616?session.prefetchSize=5

As you noted, the prefetch size is set to 1000 as a default, but it can be
changed on a per-connection basis.  Setting the value to 0 would effectively
disable prefetch.

As far as the issue with Commit not throwing an exception, I haven't had a
chance to look in to that.  If you like, you can enter a JIRA with the
information regarding current behavior and expected behavior so that it can
be scheduled to be fixed in the product.

Thanks,
Jim

On Thu, Aug 21, 2008 at 4:34 AM, SebastianR.
<Se...@de-gmbh.com>wrote:

>
> I found out that what i called a local store is in ActiveMQ called
> prefetching. This prefetching is controlled via the variable prefetchSize
> (which in NMS is set in the session.cs to a fixed value of 1000). Do I have
> influence on this value in some way ? It would even better if, there would
> be a possibilty to disable the whole prefetching process.
> I searched the forum already, and found the that method sendPullCommand()
> in
> the ActiveMQMessageConsumer class together with a prefetchSize of zero
> achieves this. However this method doesn't exist in NMS.
>
> The reason I want to disable prefetching is the following:
> As stated in the first post the Commit() method doesn't throw an exception
> if there is a connection failure. But still messages are received and
> processed correctly, because they are fetched from the local cache. This
> leads to multiple message processing, because the processed messages aren't
> acknowledged and so the broker dispatches them again, if the connection is
> re-established.
>
> How can I avoid this "multiple message processing", if I can't disable
> prefetching ?
>
> Regards, Sebastian
>
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Why-don%27t-Commit%28%29-and-Receive%28%29-throw-exceptions---%28NMS%29-tp19048072p19086911.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

Re: Why don't Commit() and Receive() throw exceptions ? (NMS)

Posted by "SebastianR." <Se...@de-gmbh.com>.
I found out that what i called a local store is in ActiveMQ called
prefetching. This prefetching is controlled via the variable prefetchSize
(which in NMS is set in the session.cs to a fixed value of 1000). Do I have
influence on this value in some way ? It would even better if, there would 
be a possibilty to disable the whole prefetching process. 
I searched the forum already, and found the that method sendPullCommand() in
the ActiveMQMessageConsumer class together with a prefetchSize of zero
achieves this. However this method doesn't exist in NMS. 

The reason I want to disable prefetching is the following:
As stated in the first post the Commit() method doesn't throw an exception
if there is a connection failure. But still messages are received and
processed correctly, because they are fetched from the local cache. This
leads to multiple message processing, because the processed messages aren't
acknowledged and so the broker dispatches them again, if the connection is
re-established.

How can I avoid this "multiple message processing", if I can't disable
prefetching ?

Regards, Sebastian




-- 
View this message in context: http://www.nabble.com/Why-don%27t-Commit%28%29-and-Receive%28%29-throw-exceptions---%28NMS%29-tp19048072p19086911.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.