All Products
Search
Document Center

RPC Attribute Explaination

Last Updated: Aug 21, 2020

This topic completely describes the SOFARPC service publishing and reference in the SOFABoot framework.

Publish a service

  1. <bean id="helloSyncServiceImpl" class="com.alipay.sofa.rpc.samples.invoke.HelloSyncServiceImpl"/>
  2. <sofa:service ref="helloSyncServiceImpl" interface="com.alipay.sofa.rpc.samples.invoke.HelloSyncService" unique-id="">
  3. <sofa:binding.bolt>
  4. <sofa:global-attrs registry="" serialize-type="" filter="" timeout="3000" thread-pool-ref=""
  5. warm-up-time="60000"
  6. warm-up-weight="10" weight="100"/>
  7. </sofa:binding.bolt>
  8. <sofa:binding.rest>
  9. </sofa:binding.rest>
  10. </sofa:service>

Attribute Summarization

Attribute Function Default value Remarks
id The ID. Bean name
class The class. N/A
ref The service interface implementation class.
interface The unique service interface ID. It is set to the actual interface class for both common calls and return calls.
unique-id The unique service tag ID.
filter The configured filter alias. Separate multiple aliases with a comma (,).
registry The server registry. Separate multiple items with a comma (,).
timeout The server execution timeout period.
serialize-type The serialization protocol. hessian2, protobuf
thread-pool-ref The thread pool used by the current port of the server. N/A
weight The static weight of the service.
warm-up-weight The preloading weight of the service.
warm-up-time The preloading time. The unit is millisecond.

Reference a service

  1. <sofa:reference jvm-first="false" id="helloSyncServiceReference"
  2. interface="com.alipay.sofa.rpc.samples.invoke.HelloSyncService" unique-id="">
  3. <sofa:binding.bolt>
  4. <sofa:global-attrs type="sync" timeout="3000" callback-ref="" callback-class="" address-wait-time="1000"
  5. connect.num="1" check="false" connect.timeout="1000" filter="" generic-interface=""
  6. idle.timeout="1000"
  7. idle.timeout.read="1000" lazy="false" loadBalancer="" registry="" retries="1"
  8. serialize-type="" />
  9. <sofa:route target-url="xxx:12200" />
  10. <sofa:method name="hello" callback-class="" callback-ref="" timeout="3000" type="sync"/>
  11. </sofa:binding.bolt>
  12. </sofa:reference>

Attribute Summarization

Attribute Function Default value Remarks
id The ID. Automatically generated
jvm-first Specifies whether to use local services first. true
interface The unique service interface ID. It is set to the actual interface class for both common calls and return calls.
unique-id The unique service tag ID.
type The call method. sync Valid values include Callback, Sync, Future, and Oneway methods.
filter The configured filter alias. List
registry The server registry. List
method The method-level configuration. Same as above.
serialize-type The serialization protocol. hessian2
target-url The direct connection URL. Register after direct connection.
generic-interface The generic interface.
connect.timeout The connection timeout period. 3000 (cover 5000)
connect.num The number of connections. 1
idle.timeout The idle timeout period.
idle.timeout.read The read idle timeout period.
loadBalancer The SLB algorithm. random
lazy Specifies whether to delay the establishment of persistent connection. false
address-wait-time The waiting time before obtaining the address. -1 It depends on the implementation and may not take effects.
timeout The calling timeout period. 3000 (cover 5000)
retries The number of retries after the operation failed. 0 The parameter depends on the cluster mode. If the mode is set to failover, this parameter is read.
callback-class The callback class. N/A This attribute is available for the callback method only.
callback-ref The callback class. N/A This attribute is available for the callback method only.