HSF provides a distributed service development framework, Taobao internal use, and generally provides the functions and some implementation basis:
1. Standard service-mode RPC
1), service definition: OSGi-based service definition mode
2), TCP/IP communication:
Io mode: NIO, using Mina framework
Connection mode: Long connection
Server-side connection pool with a limited size
WebService Way
3), serialization: Hessian serialization mechanism
2. Software load System
3. Modular, dynamic
4. Service governance
Here is a brief description of its use:
First, the HSF function is added to the project, is Maven, in Pom.xml to rely on Hsf:xml code <dependency> <groupid>com.taobao.hsf</groupid > <artifactId>hsf.connector.spring</artifactId> <version>xxx</version& Gt </dependency>
For the service framework, there must be both service provider and consumer roles, and the work to be done by the provider includes:
1. Interface code into a jar package, put into the MAVEN repository for users to download and use, and the specific code implementation does not need to put into the jar package, the user can only invoke, can not see the implementation.
2. In the corresponding HSF configuration file, provide the services provided (spring-based Bean configuration): XML code <bean id= "Xxxserviceimpl" class= " Xxx.xxxserviceimpl " /> <bean id=" Xxxserviceprovider " class= "Com.taobao.hsf.app.spring.util.HSFSpringProviderBean" init-method= "Init" > <property name= "Serviceinterface" > <value>xxx.xxxService</value> </property> <property name= "Target" > <ref bean= "Xxxserviceimpl" /> </property> <property Name= "ServiceName" > <value>xxxservice</ value> </property> <property name= " Serviceversion "> <value>xxx</value> </property> < Property name= "Servicegroup" > <value> hsf</value> </property> </bean>
After the service has been successfully provided, the HSF service can be viewed in the HSF Service Management Center.
And the work to be done by the consumer: XML code <bean name= "Xxxservice" class= "Com.taobao.hsf.app.spring.util.HSFSpringConsumerBean" init-method= "Init" > <property name= "InterfaceName" value= "Xxx.xxxservice"/> <property name= "ver Sion "value=" xxx "/> </bean>
This service can then be used.
The drawback of HSF is that it uses the specified JBoss container, and also needs to include the SAR packet extension in the container such as JBoss, which is very intrusive to the user's operating environment, if you want to run on other containers such as WebLogic or WebSphere, You need to extend the container yourself to be compatible with HSF ClassLoader loading. Taobao have similar other frameworks Dubbo, introduction see
http://www.iteye.com/magazines/103