npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wars-dubbo-js

v4.0.0

Published

Dubbo-js, using Node.js to embrace the Dubbo ecosystem. See this [Demo](https://github.com/apache/dubbo-js) to find how intelligent this project is.

Downloads

51

Readme

Apache Dubbo-js

Dubbo-js, using Node.js to embrace the Dubbo ecosystem. See this Demo to find how intelligent this project is.

Node.js CI

Features

  • Various transport protocols (Hessian, JSON-RPC etc.) supports
  • Tracing (Runtime information, Call Stack)
  • Multiple registry centers (Zookeeper, Nacos, Redis) supports or connecting to services directly
  • Extensibility, inspired from Koa Middleware
  • Builtin reconnection strategy
  • Typescript type definitions
  • Tools to automatically translate Java interfaces to Typescript type definitions
  • Dubbox supports

Architecture

Getting Started

yarn add apache-dubbo-js

Usage

Below code snippet shows how to work with the typescript type definitions which automatically translated from Java interfaces.

// ===================== service.ts ==================
// generated by interpret tools
import { BasicTypeProvider } from './providers/org/apache/dubbo/demo/BasicTypeProvider'
import { DemoProvider } from './providers/org/apache/dubbo/demo/DemoProvider'
import { ErrorProvider } from './providers/org/apache/dubbo/demo/ErrorProvider'

export default {
  BasicTypeProvider,
  DemoProvider,
  ErrorProvider
}

// =============== dubbo.ts ========================
import { Dubbo } from 'apache-dubbo-js'
import service from './service'

// create dubbo object
const dubbo = new Dubbo<typeof service>({
  application: { name: 'dubbo-js' },
  // zookeeper address
  register: 'localhost:2181',
  service
})

// main method
;(async () => {
  let { res, err } = await dubbo.service.DemoProvider.sayHello('node')
  // print {err: null, res:'hello node from dubbo service'}
  ;({ res, err } = await dubbo.service.DemoProvider.echo())
  // print {err: null, res: 'pang'}
  ;({ res, err } = await dubbo.service.DemoProvider.getUserInfo())
  // print {status: 'ok', info: { id: '1', name: 'test' }, err: null}
})()

The automatically translated typescript type definitions are not necessary, below code snippet demonstrates how to use dubbo-js without them.

// create the service to be injected
import { Dubbo } from 'apache-dubbo-js'

const demoProvider = (dubbo) =>
  dubbo.proxyService({
    dubboInterface: 'org.apache.dubbo.demo.DemoProvider',
    version: '1.0.0',
    methods: {
      sayHello(name) {
        return [java.String(name)]
      },

      echo() {},

      test() {},

      getUserInfo() {
        return [
          java.combine('org.apache.dubbo.demo.UserRequest', {
            id: 1,
            name: 'nodejs',
            email: '[email protected]'
          })
        ]
      }
    }
  })

// integrate the service in demoProvider with dubbo object constructor
const service = {
  demoProvider
}

const dubbo = new Dubbo<typeof service>({
  // ....other parameters
  service
})

How to run a quick starter?

Make sure java, maven, docker, Node, Yarn is installed locally. If you'd like to contribute, it's a good start to follow below commands to get a locally runnable project.

# cd root dir
cd dubbo-js

# start java dubbo service
chmod 755 ./start_dubbo_service.sh
sh ./start_dubbo_service.sh

# build package module
make

# start node
cd example/hello-koa
# install node modules
yarn
# start web
yarn run debug:start
# test /hello
curl http://localhost:3000/hello

# or hello-egg example
cd example/hello-egg
yarn
yarn run dev
# test /hello
http://127.0.0.1:7001/hello

How to run all tests

cd dubbo-js
sh ./start_dubbo_service.sh
yarn
make
yarn run test

How to build dubbo-js module

git clone https://github.com/apache/dubbo-js.git
cd dubbo-js
npm install -g lerna
lerna bootstrap
make build-dubbo

Next steps

Guides

Reporting bugs

Please follow the template for reporting any issues.

Knowledge Sharing

2019-meetup by hufeng

Thanks

Dubbo-js will not work without:

Many thanks to their authors fengmk2 and dead-horse.

contact us

License

Apache Dubbo is under the Apache 2.0 license. See the LICENSE file for details.