1
votes

I am trying to configure google pubsub to push messages to a servlet running on google app engine.

I am able to publish to the topic. I know that this is working because and I am able to retrieve via pull subscriptions using gcloud:

gcloud alpha pubsub subscriptions pull projects/my-project/subscriptions/my-subscription

I am also able to invoke the servlet on app engine from my web browser. But for some reason, I cannot seem to persuade pubsub to invoke the servlet when it is supposed to.

I believe that I have configured the servlet correctly.
Here is the relevant portion of my web.xml file:

<servlet>
    <servlet-name>dataExtracted</servlet-name>
    <servlet-class>com.alpine.servlets.CatchEventDataExtractedServlet</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>dataExtracted</servlet-name>
    <url-pattern>/_ah/push-handlers/dataExtracted</url-pattern>
</servlet-mapping>

<security-constraint>
    <web-resource-collection>
        <web-resource-name>push-handlers</web-resource-name>
        <url-pattern>/_ah/push-handlers/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>admin</role-name>
    </auth-constraint>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>

I am having difficulty debugging because I do not seem to have access to any logging data which might indicate the source of the error. The messages just disappear into the ether.

The pubsub topics and subscriptions reside within the same project as the app engine instance.

One thing in the "Subscriber Guide" that is a little confusing to me is this statement:

Currently the only supported endpoint is an HTTPS server that can accept Webhook delivery.

I am uncertain as to what exactly "Webhook delivery" means.

1
the webhook thing can simply be translated to: You will need a publicly available URL to have PubSub push messages there. When you subscribe you simply pass your full URL (like: https://myappid.appspot.com/path/to/some/servlet) as the pushEndpoint.konqi
For testing purposes i would loosen the auth-constraint so you can see incoming (probably failing calls) in the logs.konqi

1 Answers

1
votes

Although no logs were available for pubsub, logs were available for app engine.

In my particular case I was getting 405 errors as pubsub repeatedly tried to access a resource that was not there.

It turns out that I had implemented doGet() instead of doPost() and thus my servlet was not able to receive the push from pubsub.