Thursday, November 4, 2010

AppEngine / Google Checkout FAIL

 

I’m dying here…

appengine_googlecheckout_fail

From what I understand, Google Checkout will wait 10 seconds for a response from your callback URL.

But if your callback URL lives on App Engine, and if you are using the Google Checkout Java SDK – you’re in trouble. It will take longer than 10 seconds for your SDK to simply “warm up”.

I have tracked down the source of the problem, which I’ve blogged about earlier. It is a call to

   JAXBContext.newInstance(“com.google.checkout.sdk.domain”);

But I began wondering why this call takes *so* long on AppEngine, but only a couple seconds on my wimpy little desktop machine?

Just by examining the syntax of the above JAXB function call, one would suspect there is some Java reflection being employed to scan for all the classes present in the com.google.checkout.sdk.domain namespace. And doesn’t reflect come with some costs, like interacting with the Security Manager?  The GoogleCheckout Java SDK has 100 classes in that namespace, and I suspect Google’s JVM for AppEngine has it’s own Security Manager…   

I’m totally guessing here at a possible culprit, but I’m thinking it has to be something unique to the AppEngine environment since the same call on my wimpy dev machine is only a couple seconds vs. 20 +/- seconds on AppEngine.

I’ve already filed a bug report. I’m not sure what I am going to do next, but I have to act soon because the above errors are not going to stop. I’d really prefer to keep using the Google Checkout SDK, else I’d have to re-invent a bunch of code to deal with all the possible XML that can arrive at my callback URL – this seems a bad strategy for a system already in production – what could go wrong?! I could move that function to Rackspace, or somewhere else…  but then I’d really consider moving it all off AppEngine, and that would be too bad…

Well, something’s gotta give, and quickly.