简体   繁体   中英

app-engine iOS push notification exception: “The specified queue is unknown”

I am using the Google Sample project to setup push notification on my app-engine backend. The following method is throwing an exception

private static void enqueuePushAlertToDevices(String alertMessage, String devicesAsJson) {
    Queue notificationQueue = QueueFactory.getQueue("notification-delivery");
    notificationQueue.add(TaskOptions.Builder.withMethod(TaskOptions.Method.PULL)
        .param("alert", alertMessage)
        .param("devices", devicesAsJson));
}

And the exception is

com.google.api.server.spi.SystemService invokeServiceMethod: The specified queue is unknown : notification-delivery
java.lang.IllegalStateException: The specified queue is unknown : notification-delivery
    at com.google.appengine.api.taskqueue.QueueApiHelper.translateError(QueueApiHelper.java:104)
    at com.google.appengine.api.taskqueue.QueueImpl$2.wrap(QueueImpl.java:552)
    at com.google.appengine.api.taskqueue.QueueImpl$2.wrap(QueueImpl.java:521)
    at com.google.appengine.api.utils.FutureWrapper.wrapAndCache(FutureWrapper.java:55)
    at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:92)
    at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:88)
    at com.google.appengine.api.taskqueue.QueueApiHelper.getInternal(QueueApiHelper.java:72)
    at com.google.appengine.api.taskqueue.QueueImpl.add(QueueImpl.java:413)
....

Given that the project has been around, I imagine a number of developers have been using it. So where should I define the queue "notification-delivery" ? I understand the problem: I am using a queue that is not yet defined. But it's not clear to me where I should define it. I haven't found an answer in the sample code as yet. Thanks.

You didn't look hard enough :). Actually it's not obvious. Just copy the queue.xml from the sample into your project. The path in the sample is

/Downloads/solutions-ios-push-notification-sample-backend-java-master/war/WEB-INF

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM