我正在尝试找一个优雅框架来安排我的所有服务器组件。
服务器:
1. Receives a request, as a XML string, from the client.
2. Validates the messages ( !null && !empty mainly).
3. Unmarshalls the message into a Request object.
4. Validates the internals of the Request object (ensures all the required fields are there, ie. id, requestName etc).
5. If valid, create a specific request (I receive a lot of extra information in the original request and I need a very small subset of it to process the request).
6. Process the request and retrieve the output.
7. Send the output to the client.
目前,我的设计看起来像这样:
Controller{
processMessage(String requestMsg){
boolean isValid = validator.validate(requestMsg);
Request request = creator.createRequest(requestMsg);
isValid = validator.validate(request);
processor.processRequest();
}
控制器类由验证器,创建器和处理器组成。 收到请求后,将遵循validate - create - process模板。
现在所有这些都有效,但我不禁想知道我是否可以更好地安排这些组件。更好地松散耦合。
是否有可以使用的框架?任何想法,提示,链接都会非常有用。
干杯