The Hessian protocol is used for integrating services that utilize Hessian. It is based on HTTP communication and uses Servlet to expose services, with Dubbo embedding Jetty as the server implementation by default.
Hessian is an open-source RPC framework from Caucho, whose communication efficiency is higher than that of WebService and Java’s built-in serialization.
Dubbo’s Hessian protocol can interoperate with native Hessian services, which means:
Serializable
interface.List
, Map
, Number
, Date
, Calendar
, etc., via custom implementations; only JDK’s built-in implementations can be used, as Hessian applies special processing that causes property values in custom classes to be lost.Hessian is a lightweight RPC service implemented based on Binary-RPC protocol, demonstrating serialization and deserialization instances.
As of Dubbo 3, the Hessian protocol is no longer embedded in Dubbo and needs to be separately introduced as an independent module.
<dependency>
<groupId>org.apache.dubbo.extensions</groupId>
<artifactId>dubbo-rpc-hessian</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>com.caucho</groupId>
<artifactId>hessian</artifactId>
<version>4.0.7</version>
</dependency>
<dubbo:protocol name="hessian" port="8080" server="jetty" />
<dubbo:provider protocol="hessian" />
<dubbo:service protocol="hessian" />
<dubbo:protocol id="hessian1" name="hessian" port="8080" />
<dubbo:protocol id="hessian2" name="hessian" port="8081" />
<dubbo:reference id="helloService" interface="HelloWorld" url="hessian://10.20.153.10:8080/helloWorld" />