[appengine-java] Re: QueueFactory.getQueue( String )
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 Bonfantivbonfa...@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 -~--~~~~--~~--~--~---
[appengine-java] Re: QueueFactory.getQueue( String )
Done (#2089). BTW, I've opened two issues on the Task Queue API that I consider fairly serious (at least for what I'm trying to accomplish): #2088. A datastore Key that has a parent does not survive a round-trip through keyToString and stringToKey and still be usable as a memcache key. The bug report contains more details and a simple example that doesn't require task queues (so technically, this isn't a task queue issue). #2090. TaskOptions doesn't support multiple parameters with the same name. Again, the bug report has more details about why this is important. I'd be interested in getting some feedback on these. Vince On Tue, Sep 8, 2009 at 4:11 PM, Jason (Google)apija...@google.com wrote: Hi Vince. I think this sounds reasonable. Please open a new issue. - Jason On Sat, Sep 5, 2009 at 11: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. 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(); } } 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? Vince On Fri, Sep 4, 2009 at 6:19 PM, Vince Bonfantivbonfa...@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 -~--~~~~--~~--~--~---
[appengine-java] Re: QueueFactory.getQueue( String )
Hi Vince. I think this sounds reasonable. Please open a new issue. - Jason On Sat, Sep 5, 2009 at 11: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. 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(); } } 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? Vince On Fri, Sep 4, 2009 at 6:19 PM, Vince Bonfantivbonfa...@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 -~--~~~~--~~--~--~---
[appengine-java] Re: QueueFactory.getQueue( String )
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. 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(); } } 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? Vince On Fri, Sep 4, 2009 at 6:19 PM, Vince Bonfantivbonfa...@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 -~--~~~~--~~--~--~---