简体   繁体   English

Java:HTTP异步非阻塞远程日志记录服务器?

[英]Java: HTTP asynchronous non-blocking remote logging server?

I'm looking for a way of implementing a simple API to receive log messages (for various events across various systems). 我正在寻找一种实现简单API来接收日志消息(针对各种系统中的各种事件)的方法。

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. 我们已经得出结论,对于需要发布到此服务器的不同代码库和系统,HTTP get请求是最开放的(进入障碍最小)。

The server itself needs to provide an HTTP GET api where I would send a message eg logging.internal/?system=email&message=An email failed 服务器本身需要提供HTTP GET api,我可以在其中发送消息,例如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? 有谁知道用Java来实现这一目标的任何框架或适当的方法?

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. 在Java中,对于服务器,您可以对Restful部分使用任何JAX-RS实现,并且在处理消息时,只需调用异步EJB方法( http://docs.oracle.com/javaee/6/tutorial/ doc / gkkqg.html ),它将进行更长的处理。 This will allow the RESTful request to return as fast as possible. 这将允许RESTful请求尽快返回。

In this case, the only blocking part will be the http request/response. 在这种情况下,唯一的阻止部分将是http请求/响应。

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). 如果要减少阻塞,也可以使用Async方法(或如果使用Java EE 5,则使用消息驱动Bean)从客户端发出RESTful请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM