cometta
cometta

Reputation: 35689

GAE messaging service

Let's say I want my corporate server to communicate with Google App Engine and vice versa. I know that GAE does not support JMS,RMI etc. What is the best alternative for this kind of communication? Use task queue? (I think HTTP get() is not suitable for this kind of communication).

Both my corporate server and GAE application use Spring framework.

Upvotes: 1

Views: 1699

Answers (3)

Allan Veloso
Allan Veloso

Reputation: 6369

Yes, task queue. It does the same that JMS does.

You can also use Google Cloud Pub/Sub or any other similar service.

What you going to do is basically configure a WebServlet and implement the HttpServlet doPost method. In specific for Google Cloud Pub/Subm you should use the url pattern /_ah/push-handlers

Here the example from the docs of AppEngine for the receiver:

// The Enqueue servlet should be mapped to the "/enqueue" URL.
// With @WebServlet annotation the webapp/WEB-INF/web.xml is no longer required.
@WebServlet(
    name = "TaskEnque",
    description = "taskqueue: Enqueue a job with a key",
    urlPatterns = "/taskqueues/enqueue"
)
public class Enqueue extends HttpServlet {

  protected void doPost(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String key = request.getParameter("key");

    // Add the task to the default queue.
    Queue queue = QueueFactory.getDefaultQueue();
    queue.add(TaskOptions.Builder.withUrl("/worker").param("key", key));

    response.sendRedirect("/");
  }
}

Upvotes: 0

Nick Johnson
Nick Johnson

Reputation: 101149

Use any of a number of HTTP based RPC protocols: REST, JSONRPC, SOAP, etc.

You say "I think http get() is not suitable for this kind of communication" - why not?

Upvotes: 1

Alex Martelli
Alex Martelli

Reputation: 881805

XMPP is a powerful and flexible messaging protocol, and this article shows how to do the GAE side of it in both Java and Python. For XMPP implementations (in Java and others) outside of GAE, see this SO question.

For accessing from GAE a lot of bulky secure data that lives behind your corporate firewall, Google recommends implementing the Secure Data Connector (I'm pointing specifically to the URL of the Java tutorial for SDC with GAE).

Upvotes: 2

Related Questions