Hessian Learning (1) - Hessian Principle Analysis

First, the basic principle of remote communication protocol:

        All that network communication needs to do is to transmit streams from one computer to another, based on the transport protocol and network IO.

        Among them, the famous transmission protocols are http, tcp, udp, etc. http, tcp, udp are all transmission protocols extended for certain application scenarios based on the concept of Socket.

        Network IO mainly includes bio, nio and aio. All distributed application communication is realized based on this principle, just for the ease of use of the application. Various languages ​​usually provide some application layer protocols that are closer to the ease of use of the application. .

 

2. Application-level protocol Binary-RPC:

       Binary-RPC is a remote invocation protocol similar to RMI. It differs from RMI in that it defines the requested information (requested objects, methods, parameters, etc.) in a standard binary format. The advantage of this is that it can also be used when communicating across languages.

 Binary - A remote communication process of the RPC protocol:

        1. The client initiates a request and fills in the request information according to the Binary-RPC protocol;

        2. After filling, convert the binary format file into a stream and transmit it through the transmission protocol;

        3. After receiving the stream, it is converted into a binary format file, and the requested information is obtained and processed according to the Binary-RPC protocol;

        4. After processing, write the result into a binary format file according to the Binary-RPC protocol and return it.

 Summary of Binary-RPC related issues:

        1. What is the standard format of transmission?

           --- Standard format binary files.

        2. How to convert the request into a transmitted stream?

           --- Convert binary format files to streams.

        3. How to receive and process streams?

           —— Obtain the requested stream through the listening port, convert it into a binary file, obtain the requested information according to the protocol, process it, and write the result into XML for return.

        4. What is the transmission protocol?

          ———Http 。

 

3. Hessian - a library for remote communication

Hessian is a binary-RPC based remote communication library provided by caucho.

1. What protocol is it based on?

       - Implemented based on Binary-RPC protocol.

2. How to initiate a request?

      ——The request needs to be initiated through the API provided by Hessian itself.

3. How to convert the request into a format that conforms to the protocol?

      ——Hessian serializes the request information through its custom serialization mechanism to generate a binary stream.

4. What transmission protocol is used for transmission?

      ——Hessian transmits based on Http protocol.

5. What mechanism is the responder based on to receive the request?

      - The responder receives the request according to the API provided by Hessian.

6. How to restore the stream to the transmission format?

      ——Hessian deserializes the request information according to its private serialization mechanism, and when it is passed to the user, it is the corresponding request information object.

7. How to respond after processing?

      —— Return directly after processing. Hessian serializes the result object and transmits it to the calling end.

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326637499&siteId=291194637