You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Andy Grove <an...@codesuccess.com> on 2007/10/26 11:47:50 UTC

QPID exception handling / logging

Hi,

If I attempt to send messages to a topic that has no listeners I notice this
in the logging output. If I set the logging threshold to INFO, WARN or ERROR
I do not see the problem and no exception is thrown to the client
application. Shouldn''t the log output at least be WARN or ERROR?

26 Oct 2007 10:44:42,790 [pool-2-thread-1] DEBUG
org.apache.qpid.client.AMQConnection - exceptionReceived done
by:pool-2-thread-1
org.apache.qpid.client.AMQNoRouteException: Error: Topic MYTOPICNAME is not
known to org.apache.qpid.server.exchange.DestWildExchange[amq.topic] [error
code 312: no route]
    at org.apache.qpid.client.AMQSession$9.run(AMQSession.java:2312)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
ThreadPoolExecutor.java:650)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(
ThreadPoolExecutor.java:675)
    at java.lang.Thread.run(Thread.java:595)


Thanks,

Andy.

Re: QPID exception handling / logging

Posted by Martin Ritchie <ri...@apache.org>.
You don't need to create a JIRA 509 is still open, as is a good many
M2 JIRAs. This is to remind me to verify they have all been merged
correctly.

Hopefully in the next week or so I shall have the merge from M2 to
trunk completed. There has been so much file movement on trunk that
the merge is quite difficult.

On 26/10/2007, Andy Grove <an...@codesuccess.com> wrote:
> Hi Martin,
>
> Thanks for the information. I'm using a build from trunk that I created
> yesterday. If I have no subscribers to the topic I do not get any log
> messages at ERROR level. It is only if I enable DEBUG logging that I
> actually see the problem. Should I create a JIRA for this with my source
> code and log output?
>
> However, I hadn't set a ConnectionListener and that's really the right
> answer - I've just tested that and it works correctly.
>
> Thanks,
>
> Andy.
>
> On 10/26/07, Martin Ritchie <ri...@apache.org> wrote:
> >
> > Andy.
> > If you implement the qpid.jms.ConnectionListener then you will get
> > notified of the exception.
> > If you don't then there will be an error level event logged:
> >
> > ERROR Throwable Received but no listener set
> > org.apache.qpid.client.AMQNoRouteException: Error: Topic.....
> >
> > That is if you are using the current M2/M2.1 branch, if you are using
> > anything else you are quite right the exception swallowing is not very
> > helpful.
> >
> > The reason you are getting this is also an out standing issue:
> > https://issues.apache.org/jira/browse/QPID-509
> > Qpid defaults to setting the Mandatory flag to be true for all
> > messages. This means that the route must exist when the message is
> > sent. For topics that means there _must_ be a subscriber or the
> > message is returned.
> >
> > To get round this when you create your producer you must use the
> > qpid.jms.Session interface rather than the Java jms interface.
> >
> > createProducer(Destination destination, boolean mandatory, boolean
> > immediate)
> >
> > Will allow you to change the mandatory flag to false. The default for
> > immediate is also false, immediate means that the message will be
> > returned if none of the current subscribers are able to process the
> > message. i.e. the message will not be queued.
> >
> >
> > HTH
> >
> >
> > On 26/10/2007, Andy Grove <an...@codesuccess.com> wrote:
> > > Hi,
> > >
> > > If I attempt to send messages to a topic that has no listeners I notice
> > this
> > > in the logging output. If I set the logging threshold to INFO, WARN or
> > ERROR
> > > I do not see the problem and no exception is thrown to the client
> > > application. Shouldn''t the log output at least be WARN or ERROR?
> > >
> > > 26 Oct 2007 10:44:42,790 [pool-2-thread-1] DEBUG
> > > org.apache.qpid.client.AMQConnection - exceptionReceived done
> > > by:pool-2-thread-1
> > > org.apache.qpid.client.AMQNoRouteException: Error: Topic MYTOPICNAME is
> > not
> > > known to org.apache.qpid.server.exchange.DestWildExchange[amq.topic]
> > [error
> > > code 312: no route]
> > >     at org.apache.qpid.client.AMQSession$9.run(AMQSession.java:2312)
> > >     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
> > > ThreadPoolExecutor.java:650)
> > >     at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> > > ThreadPoolExecutor.java:675)
> > >     at java.lang.Thread.run(Thread.java:595)
> > >
> > >
> > > Thanks,
> > >
> > > Andy.
> > >
> >
> >
> > --
> > Martin Ritchie
> >
>


-- 
Martin Ritchie

Re: QPID exception handling / logging

Posted by Andy Grove <an...@codesuccess.com>.
Hi Martin,

Thanks for the information. I'm using a build from trunk that I created
yesterday. If I have no subscribers to the topic I do not get any log
messages at ERROR level. It is only if I enable DEBUG logging that I
actually see the problem. Should I create a JIRA for this with my source
code and log output?

However, I hadn't set a ConnectionListener and that's really the right
answer - I've just tested that and it works correctly.

Thanks,

Andy.

On 10/26/07, Martin Ritchie <ri...@apache.org> wrote:
>
> Andy.
> If you implement the qpid.jms.ConnectionListener then you will get
> notified of the exception.
> If you don't then there will be an error level event logged:
>
> ERROR Throwable Received but no listener set
> org.apache.qpid.client.AMQNoRouteException: Error: Topic.....
>
> That is if you are using the current M2/M2.1 branch, if you are using
> anything else you are quite right the exception swallowing is not very
> helpful.
>
> The reason you are getting this is also an out standing issue:
> https://issues.apache.org/jira/browse/QPID-509
> Qpid defaults to setting the Mandatory flag to be true for all
> messages. This means that the route must exist when the message is
> sent. For topics that means there _must_ be a subscriber or the
> message is returned.
>
> To get round this when you create your producer you must use the
> qpid.jms.Session interface rather than the Java jms interface.
>
> createProducer(Destination destination, boolean mandatory, boolean
> immediate)
>
> Will allow you to change the mandatory flag to false. The default for
> immediate is also false, immediate means that the message will be
> returned if none of the current subscribers are able to process the
> message. i.e. the message will not be queued.
>
>
> HTH
>
>
> On 26/10/2007, Andy Grove <an...@codesuccess.com> wrote:
> > Hi,
> >
> > If I attempt to send messages to a topic that has no listeners I notice
> this
> > in the logging output. If I set the logging threshold to INFO, WARN or
> ERROR
> > I do not see the problem and no exception is thrown to the client
> > application. Shouldn''t the log output at least be WARN or ERROR?
> >
> > 26 Oct 2007 10:44:42,790 [pool-2-thread-1] DEBUG
> > org.apache.qpid.client.AMQConnection - exceptionReceived done
> > by:pool-2-thread-1
> > org.apache.qpid.client.AMQNoRouteException: Error: Topic MYTOPICNAME is
> not
> > known to org.apache.qpid.server.exchange.DestWildExchange[amq.topic]
> [error
> > code 312: no route]
> >     at org.apache.qpid.client.AMQSession$9.run(AMQSession.java:2312)
> >     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
> > ThreadPoolExecutor.java:650)
> >     at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> > ThreadPoolExecutor.java:675)
> >     at java.lang.Thread.run(Thread.java:595)
> >
> >
> > Thanks,
> >
> > Andy.
> >
>
>
> --
> Martin Ritchie
>

Re: QPID exception handling / logging

Posted by Martin Ritchie <ri...@apache.org>.
Andy.
If you implement the qpid.jms.ConnectionListener then you will get
notified of the exception.
If you don't then there will be an error level event logged:

ERROR Throwable Received but no listener set
org.apache.qpid.client.AMQNoRouteException: Error: Topic.....

That is if you are using the current M2/M2.1 branch, if you are using
anything else you are quite right the exception swallowing is not very
helpful.

The reason you are getting this is also an out standing issue:
https://issues.apache.org/jira/browse/QPID-509
Qpid defaults to setting the Mandatory flag to be true for all
messages. This means that the route must exist when the message is
sent. For topics that means there _must_ be a subscriber or the
message is returned.

To get round this when you create your producer you must use the
qpid.jms.Session interface rather than the Java jms interface.

createProducer(Destination destination, boolean mandatory, boolean immediate)

Will allow you to change the mandatory flag to false. The default for
immediate is also false, immediate means that the message will be
returned if none of the current subscribers are able to process the
message. i.e. the message will not be queued.


HTH


On 26/10/2007, Andy Grove <an...@codesuccess.com> wrote:
> Hi,
>
> If I attempt to send messages to a topic that has no listeners I notice this
> in the logging output. If I set the logging threshold to INFO, WARN or ERROR
> I do not see the problem and no exception is thrown to the client
> application. Shouldn''t the log output at least be WARN or ERROR?
>
> 26 Oct 2007 10:44:42,790 [pool-2-thread-1] DEBUG
> org.apache.qpid.client.AMQConnection - exceptionReceived done
> by:pool-2-thread-1
> org.apache.qpid.client.AMQNoRouteException: Error: Topic MYTOPICNAME is not
> known to org.apache.qpid.server.exchange.DestWildExchange[amq.topic] [error
> code 312: no route]
>     at org.apache.qpid.client.AMQSession$9.run(AMQSession.java:2312)
>     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
> ThreadPoolExecutor.java:650)
>     at java.util.concurrent.ThreadPoolExecutor$Worker.run(
> ThreadPoolExecutor.java:675)
>     at java.lang.Thread.run(Thread.java:595)
>
>
> Thanks,
>
> Andy.
>


-- 
Martin Ritchie