Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions README.en-US.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@


PyDubbo
=======

A Python client for invoking Dubbo services.

Protocol Support
------------
Since Dubbo supports multiple protocol extensions, currently only the default Dubbo protocol (dubbo + hessian2) is supported.
Support for other protocols will be added gradually.

Installation
--------

Runtime Environment
-----------
Due to the restrictions of the Dubbo protocol, remote calls require a list of parameter types for the interface. Therefore, the client needs to read the Java class files of the Dubbo interface to obtain the parameter type list.

Example
----------
config = { 'classpath' : '%classpath%' }
client = Dubbo((('localhost', 20880),), config)
remoteService = client.getProxy('com.test.RemoteService')

print remoteService.getTestInfo(123)

Java Object Related
----------------
When the interface input/output requires a Java Class, use an instance of Object.

Configuration Reference
-----------
The `config` parameter of the Dubbo object contains extensive settings. Currently supported configurations are as follows:

### owner
Specifies the owner of the Dubbo client.
### customer
Specifies the customer name of the Dubbo client.
### classpath
Specifies the path to the Java class files corresponding to the Dubbo remote interface, separated by colons or semicolons.
`JAR` format is supported.
This parameter is optional; you can specify it via the environment variable `PD_CLASSPATH` instead. The `config` parameter takes precedence over the environment variable.
### reference
A dictionary containing detailed configurations for each specific interface.
`'interfaceName' : referenceConfig`

referenceConfig Reference
-----------------------
### async
Specifies whether the interface call is asynchronous. Example usage:
remoteService.getTestInfo(123)
future1 = RpcContext.future
remoteService.getTestInfo(124)
future2 = RpcContext.future

result1 = future1.get()
result2 = future2.get()

### withReturn
Specifies whether to wait for the return value of the interface. If set to False, it will not wait for the interface to return.

### method
A dictionary containing specific configurations for each method in the interface.
`'methodName' : methodConfig`

### timeout
Timeout for interface calls, in seconds. Can be a floating-point number.

methodConfig Reference
----------------------
### async
Same as `async` in `referenceConfig`.
### withReturn
Same as `withReturn` in `referenceConfig`.
### timeout
Same as `timeout` in `referenceConfig`.