Git Product home page Git Product logo

dubbo-py's People

Contributors

feiyuw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dubbo-py's Issues

python调用java的dubbo服务返回报错undecoded!

python 客户端代码

arg = new_object(
    'org.apache.dubbo.samples.User',
    name='sssssss',
    age=10
    )
print(arg)

resp = client.send_request_and_return_response(
    service_name='org.apache.dubbo.samples.api.GreetingsService',
    method_name='sayHiOjb',
    args=[arg])

print(resp.ok)   # False
print(resp.data)  # None
print(resp.error)  # division by zero

返回错误信息
WARNING:root:bytes "b'056e6968616f4805647562626f05322e302e325a'" undecoded!

java 范型调用问题

package com.hello.consumer;

import com.alibaba.dubbo.config.ApplicationConfig;
import com.alibaba.dubbo.config.ReferenceConfig;
import com.alibaba.dubbo.config.RegistryConfig;
import com.alibaba.dubbo.rpc.service.GenericService;

/**

  • dubbo泛化调用invoker 调用入口

  • @author mazhenjie

  • @SInCE 2019/4/26
    */
    public class DubboGenericInvoker {

    public static void main(String[] args) {
    ApplicationConfig application = new ApplicationConfig();
    application.setName("api-generic-consumer");

     RegistryConfig registry = new RegistryConfig();
     registry.setAddress("zookeeper://172.20.30.76:2181");
    
     application.setRegistry(registry);
     
     ReferenceConfig<GenericService> reference = new ReferenceConfig<GenericService>();
     // 弱类型接口名
     reference.setInterface("calc");
     reference.setVersion("1.0.0");
     reference.setGroup("dubbo");
     // 声明为泛化接口
     reference.setGeneric(true);
     reference.setApplication(application);
    
     // 用com.alibaba.dubbo.rpc.service.GenericService可以替代所有接口引用
     GenericService genericService = reference.get();
    
      Object name = genericService.$invoke("multi2", new String[] {String.class.getName()}, new Object[]{"2"});
     System.out.println(name);
    

    }
    }


直接进
if not handler:
logging.warning(f'no handler for {msg.service_name}.{msg.method_name}')
continue
针对这个如何修改???在线等

dubbo-py使用疑问

1.Dubbo-py 注册到zk后 的服务接口可以用java调用 么?
2.测试例子注册到DUBBOADMIN中 关闭程序 怎么注册的服务接口不消失

提供的provider,调用时提示WARNING:root:no handler for b'com.****.mock.demo.api.IMatchService55'.b'$invoke'

对比了一下,开发说需要加group,就在server中增加了group,timeout
同时在url = f'dubbo://{self._host}:{self._port}/{service}?anyhost=true增加了{self._app}/
但是增加了后调用依然有问题,我是通过jmeter调用的,麻烦大神帮忙看看是怎么回事,谢谢
url = f'dubbo://{self._host}:{self._port}/{self._app}/{service}?anyhost=true
class DubboService(object):
''' Dubbo service class, provide dubbo service:
1. register
2. handler
'''
def init(self, port, app, group="open-platform",timeout=30000,owner="member",dubbo_version='2.5.3'):
self._host = get_pub_ip()
self._port = port
self._app = app
self._dubbo_version = dubbo_version
self._services = {} # {'service-1': {method1: handler-1, method2: handler-2}}
self._server = _ServerThread(_DubboServer(('0.0.0.0', self._port), _get_dubbo_request_handler(self._services)))
#by Richard
self._group = group
self._timout = timeout
# self._generic = generic
self._owner = owner

def register(self, zk, version='1.0.0', revision='1.0.0'):
    client = KazooClient(zk)
    client.start()
    for service, methods in self._services.items():
        logging.info(f'register service "{service}", methods "{methods}" to zookeeper "{zk}"')
        # url = f'dubbo://{self._host}:{self._port}/{service}?anyhost=true&application={self._app}&dubbo={self._dubbo_version}&interface={service}&methods={",".join(methods)}&pid={next(_pid_gen)}&revision={revision}&side=provider&timestamp={get_timestamp()}&version={version}'
        url = f'dubbo://{self._host}:{self._port}/{self._app}/{service}?anyhost=true&application={self._app}&default.timeout={self._timout}&dubbo={self._dubbo_version}&generic=false&group={self._group}&interface={service}&methods={",".join(methods)}&owner={self._owner}&pid={next(_pid_gen)}&revision={revision}&side=provider&timestamp={get_timestamp()}&version={version}'
        print(url)
        client.ensure_path(f'/dubbo/{service}/providers/{quote_plus(url)}')
        print(f'/dubbo/{service}/providers/{quote_plus(url)}')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.