Google Pub / Sub Strategy for Local GAE Java Server

My team and I are very interested in including Google Pub / Sub in our application, as this will solve some connection problems. The problem we are facing is how to run local integration tests with the java appengine dev server.

What i have done so far:

  • run the pub emulator and set the PUBSUB_EMULATOR_HOST environment variable
  • run our application on the java dev server. which creates topics and subscriptions, and then sends some messages to topics.

I assume that I am doing something wrong, because:

  • topics and subscriptions created in the cloud (perhaps they should have been created in the pubsub emulator?)
  • messages are displayed and we return message identifiers, but the endpoint or error messages in the cloud or emulator are not reached.

From this, I am pretty sure that the emulator is not picked up by the dev server.

I also have some deeper questions regarding our testing strategy. Is local integration testing really feasible these days and with an increase in the number of cloud services. Should we focus more on test suite suites for integrating with cloud instances? If so, how can we ensure that developers are confident in their code before deploying to the cloud testing environment, and will this significantly increase the feedback loop?

UPDATE

Using the Builder class for the Java API APIs for Java Builder, I was able to enter url (localhost: 8010) from the local configuration, which now allows me to successfully publish the local emulator.

Pubsub client = new Pubsub.Builder(httpTransport, jsonFactory, initializer) .setApplicationName(getProjectId()) .setRootUrl(rootUrl).build(); 

I forced the port used to simplify the configuration for the rest of my command, rather than being dependent on a dynamically changing port.

 gcloud beta emulators pubsub start --host-port localhost:8010 

Now the theme, subscription and messages are successfully created on the emulator. Unfortunately, I still do not receive messages directed to registered endpoints.

UPDATE 2

gcloud version 120.0.0 seems to improve the situation, but now I get the following error:

 { "code" : 400, "message" : "Payload isn't valid for request.", "status" : "INVALID_ARGUMENT" } 
+7
java google-app-engine google-cloud-pubsub
source share
1 answer

Will the latest gcloud utility update by the local pubsub server be fixed. This issue resolved this: https://code.google.com/p/cloud-pubsub/issues/detail?id=41

0
source share

All Articles