0

I'm looking for a way of implementing a simple API to receive log messages (for various events across various systems).

We've concluded an HTTP get request is the most open (lowest barrier to entry) for the different code bases and systems that would need to post to this server.

The server itself needs to provide an HTTP GET api where I would send a message e.g. logging.internal/?system=email&message=An email failed

However we'd like this to be non blocking so any application can throw information to this server and never have to wait (not slowing any production systems).

Does anyone know of any framework to implement this in Java, or an appropriate approach?

5
  • Have you considered using a web service? Commented Nov 21, 2012 at 11:51
  • If you want to integrate a web-server (i.e. something that listens for connections and serves HTTP-requests) you could use Jetty for instance. But I would suggest you use POST instead of GET for posting things such as log messages. Commented Nov 21, 2012 at 11:53
  • 2
    Why GET when this is clearly a POST? Other than that, implementing asynchronicity is just a matter of your internal design. The server synhronously responds with OK and internally pushes the work to be done to some work queue. Commented Nov 21, 2012 at 11:53
  • @PezCuckow Marko is right, you should do it ReSTful, and the "non-blockingness" is the job of the server component. For the server component, I'd take a look at Apache HttpCore, that has NIO HTTP server code implementation example too. It is really easy to functionally accomplish what you want to do using that. Commented Nov 21, 2012 at 11:59
  • @Marko the get is because any application can make a get request without an HTTP library. I agree this should be using post! Commented Nov 21, 2012 at 14:08

1 Answer 1

1

In java, for the server, you can use any implementation of JAX-RS for the Restful part, and when processing the message, just call an asynchronous EJB method ( http://docs.oracle.com/javaee/6/tutorial/doc/gkkqg.html ), which will do the longer processing. This will allow the RESTful request to return as fast as possible.

In this case, the only blocking part will be the http request/response.

If you want to make it less blocking, issue the RESTful request from the client in an Async method as well (or a Message Driven Bean if using Java EE 5).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.