{"id":28684911,"url":"https://github.com/node-modules/js-remoting-for-apache-dubbo","last_synced_at":"2025-06-14T03:07:51.785Z","repository":{"id":57216918,"uuid":"77117085","full_name":"node-modules/js-remoting-for-apache-dubbo","owner":"node-modules","description":"dubbo protocol implement","archived":false,"fork":false,"pushed_at":"2019-04-28T07:11:18.000Z","size":88,"stargazers_count":22,"open_issues_count":1,"forks_count":2,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-06-01T13:44:00.825Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/node-modules.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-22T06:06:31.000Z","updated_at":"2023-04-17T03:28:04.000Z","dependencies_parsed_at":"2022-09-04T18:52:56.933Z","dependency_job_id":null,"html_url":"https://github.com/node-modules/js-remoting-for-apache-dubbo","commit_stats":null,"previous_names":["dubbo/dubbo-remoting-js","dubbo/js-remoting-for-apache-dubbo"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/node-modules/js-remoting-for-apache-dubbo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fjs-remoting-for-apache-dubbo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fjs-remoting-for-apache-dubbo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fjs-remoting-for-apache-dubbo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fjs-remoting-for-apache-dubbo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/node-modules","download_url":"https://codeload.github.com/node-modules/js-remoting-for-apache-dubbo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fjs-remoting-for-apache-dubbo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259752078,"owners_count":22905972,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-14T03:07:41.161Z","updated_at":"2025-06-14T03:07:51.780Z","avatar_url":"https://github.com/node-modules.png","language":"JavaScript","readme":"# js-remoting-for-apache-dubbo\ndubbo remoting\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![David deps][david-image]][david-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/js-remoting-for-apache-dubbo.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/js-remoting-for-apache-dubbo\n[travis-image]: https://img.shields.io/travis/dubbo/js-remoting-for-apache-dubbo.svg?style=flat-square\n[travis-url]: https://travis-ci.org/dubbo/js-remoting-for-apache-dubbo\n[codecov-image]: https://codecov.io/gh/dubbo/js-remoting-for-apache-dubbo/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/dubbo/js-remoting-for-apache-dubbo\n[david-image]: https://img.shields.io/david/dubbo/js-remoting-for-apache-dubbo.svg?style=flat-square\n[david-url]: https://david-dm.org/dubbo/js-remoting-for-apache-dubbo\n[snyk-image]: https://snyk.io/test/npm/js-remoting-for-apache-dubbo/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/js-remoting-for-apache-dubbo\n[download-image]: https://img.shields.io/npm/dm/js-remoting-for-apache-dubbo.svg?style=flat-square\n[download-url]: https://npmjs.org/package/js-remoting-for-apache-dubbo\n\n## Introduction\n\n[Dubbo](http://dubbo.apache.org/en-us/) Protocol Nodejs Implement\n\n- Common Exchange Packet\n\n```\n 0      1      2             4             6             8            10            12\n +------+------+------+------+------+------+------+------+------+------+------+------+\n |    MAGIC    | flag |status|                        packet id                      |\n +-------------+-------------+-------------+-------------+-------------+-------------+\n |        body length        |                          body                         |\n +---------------------------+                                                       +\n |                                     ... ...                                       |\n +-----------------------------------------------------------------------------------+\n```\n\n- Dubbo Request Packet\n\n```\n 0      1      2             4             6             8            10            12\n +------+------+------+------+------+------+------+------+------+------+------+------+\n |    MAGIC    | flag |      |                        packet id                      |\n +-------------+-------------+-----------------+-------------------+-----------------+\n |        body length        |  dubbo version  |   service path    | service version |\n +---------------+-----------+-----------+-----+-------------------+-----------------+\n |  method name  | arguments description |                                           |\n +---------------+-----------------------+                arguments                  +\n |                                        ...  ...                                   |\n +-----------------------------------------------------------------------------------+\n |                                   attachments                                     |\n +-----------------------------------------------------------------------------------+\n```\n\n- Dubbo Response Packet\n\npacket status ok\n```\n 0      1      2             4             6             8            10            12\n +------+------+------+------+------+------+------+------+------+------+------+------+\n |    MAGIC    | flag |status|                        packet id                      |\n +-------------+-------------+---------------------------+---------------------------+\n |        body length        |        result flag        |                           |\n +---------------------------+---------------------------+                           +\n |                             result or exception ...                               |\n +-----------------------------------------------------------------------------------+\n```\n\npacket status not ok\n```\n 0      1      2             4             6             8            10            12\n +------+------+------+------+------+------+------+------+------+------+------+------+\n |    MAGIC    | flag |status|                        packet id                      |\n +-------------+-------------+---------------------------+---------------------------+\n |        body length        |                   error message                       |\n +---------------------------+-------------------------------------------------------+\n```\n\n## Install\n\n```bash\n$ npm install dubbo-remoting --save\n```\n\n## Usage\n\nYou can use this dubbo protocol implementation with the [sofa-rpc-node](https://github.com/alipay/sofa-rpc-node)\n\n### 1. Install \u0026 Launch zk\n\n```bash\n$ brew install zookeeper\n\n$ zkServer start\nZooKeeper JMX enabled by default\nUsing config: /usr/local/etc/zookeeper/zoo.cfg\nStarting zookeeper ... STARTED\n```\n\n### 2. Expose a dubbo service\n\n```js\n'use strict';\n\nconst { RpcServer } = require('sofa-rpc-node').server;\nconst { ZookeeperRegistry } = require('sofa-rpc-node').registry;\nconst protocol = require('dubbo-remoting');\n\nconst logger = console;\n\n// 1. create zk registry client\nconst registry = new ZookeeperRegistry({\n  logger,\n  address: '127.0.0.1:2181',\n});\n\n// 2. create rpc server\nconst server = new RpcServer({\n  logger,\n  registry,\n  port: 12200,\n  protocol,\n});\n\n// 3. add service\nserver.addService({\n  interfaceName: 'com.nodejs.test.TestService',\n}, {\n  async plus(a, b) {\n    return a + b;\n  },\n});\n\n// 4. launch the server\nserver.start()\n  .then(() =\u003e {\n    server.publish();\n  });\n```\n\n### 3. Call the dubbo service\n\n```js\n'use strict';\n\nconst { RpcClient } = require('sofa-rpc-node').client;\nconst { ZookeeperRegistry } = require('sofa-rpc-node').registry;\nconst protocol = require('dubbo-remoting');\nconst logger = console;\n\n// 1. create zk registry client\nconst registry = new ZookeeperRegistry({\n  logger,\n  address: '127.0.0.1:2181',\n});\n\nasync function invoke() {\n  // 2. create rpc client with dubbo protocol\n  const client = new RpcClient({\n    logger,\n    registry,\n    protocol,\n  });\n  // 3. create rpc service consumer\n  const consumer = client.createConsumer({\n    interfaceName: 'com.nodejs.test.TestService',\n  });\n  // 4. wait consumer ready\n  await consumer.ready();\n\n  // 5. call the service\n  const result = await consumer.invoke('plus', [1, 2], { responseTimeout: 3000 });\n  console.log('1 + 2 = ' + result);\n}\n\ninvoke().catch(console.error);\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-modules%2Fjs-remoting-for-apache-dubbo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnode-modules%2Fjs-remoting-for-apache-dubbo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-modules%2Fjs-remoting-for-apache-dubbo/lists"}