On Sep 6, 4:48 am, Vince Bonfanti <vbonfa...@gmail.com> wrote:
> I found the answer to this: the Queue.add() method throws
> IllegalArgumentException if the specified queue isn't configured (BTW,
> the message in the IllegalArgumentException is "The specified queue is
> unknown :" but doesn't actually include the queue name in the message
> string). This isn't as nice as what I'd like, but I can see that the
> queue.xml file isn't processed until Queue.add() is invoked.

The Java task queue library never processes queue.xml.

There is no other feedback that the queue is not configured from the
API other than the exception given.

>
> I guess my workaround will be to try to add a dummy task to the queue
> when I create it:
>
>     private static Queue queue;
>
>     static {
>         queue = QueueFactory.getQueue( "myQueue" );
>         try {
>             queue.add();
>         } catch ( IllegalArgumentException e ) {
>             queue = QueueFactory.getDefaultQueue();
               queue.add(); ...
>         }
>     }

Note that this also may fail.  The "default" queue is only special in
that one is created for you if it does not exist but it may also be
configured "off" or paused.

>
> I'm trying to simplify configuration for users of GaeVFS
> (http://code.google.com/p/gaevfs/). Rather than requiring them to
> configure task queues for GaeVFS, I'd like to have it use the default
> queue by default. However, if they want to change the behavior for
> specific queues, then they can configure them explicitly.
>
> Should I open an issue for a simpler way to detect if a queue is
> configured? or is this something that's unlikely to change?

I think I see where you're coming from here but if you can file a bug
it would help us understand how to improve the API.


>
> Vince
>
> On Fri, Sep 4, 2009 at 6:19 PM, Vince Bonfanti<vbonfa...@gmail.com> wrote:
> > My first question on task queues...
>
> > I'd like to design my application to use a named (configured) queue if
> > it exists, but to drop back to using the default queue if the named
> > queue isn't configured. I'd like to do something like this:
>
> >    Queue q = QueueFactory.getQueue( "myQueue" );
> >    if ( q == null ) {
> >        q = QueueFactory.getDefaultQueue();
> >    }
>
> > But, the documentation for QueueFactory.getQueue( String ) implies
> > that this isn't how it works:
>
> >    "Attempting to use a non-existing queue name may result in errors
> > at the point of use of the Queue object and not when calling
> > getQueue(String)."
>
> > Is there a way to simply and reliably determine whether a given queue
> > name has been configured?
>
> > Vince
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to