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

nzd

v1.0.1

Published

node版zookeeper-dubbo

Downloads

4

Readme

nzd

a fork of [node-zookeeper-dubbo]:https://github.com/p412726700/node-zookeeper-dubbo nodejs通过dubbo默认协议通信

Usage

const nzd=require('nzd');
const app=require('express')();
const opt={
  application:{name:'fxxk'},
  register:'www.cctv.com:2181',
  dubboVer:'2.5.3.6',
  root:'dubbo',
  dependencies:{
    Foo:{
      interface:'com.service.Foo',
      version:'LATEST',
      timeout:6000,
      group:'isis',
      methodSignature: {
        findById : (id) => [ {'$class': 'java.lang.Long', '$': id} ],
        findByName : (name) => (java) => [ java.String(name) ],
      }
    },
    Bar:{
      interface:'com.service.Bar',
      version:'LATEST',
      timeout:6000,
      group:'gcd'
    }
  }  
}
opt.java = require('js-to-java')

const Dubbo=new nzd(opt);
Dubbo.connect();

const customerObj = {
  $class: 'com.xxx.XXXDTO',
  $: {
    a: 1,
    b: 'test',
    c: {$class: 'java.lang.Long', $: 123}
  }
};

app.get('/foo',(req,res)=>{
  Dubbo.Foo
    .xxMethod({'$class': 'java.lang.Long', '$': '10000000'},customerObj)
    .then(data=>res.send(data))
    .catch(err=>res.send(err))
})

app.get('/foo/findById',(req,res)=>{
  Dubbo.Foo
    .findById(10000)
    .then(data=>res.send(data))
    .catch(err=>res.send(err))
})

app.listen(9090)


注意

须等待初始化完毕才能正常使用,标志:Dubbo service init done

如果要和1.x版本共存的话试试这个,niv.

参数配置说明

  • application
    • name - 项目名称,必填
  • register - zookeeper服务地址,必填
  • dubboVer - dubbo版本,必填
  • root - 注册到zookeeper上的根节点名称
  • dependencies - 依赖的服务集,必填
    • Foo - 自定义名称,这里方便起见用Foo作为事例,必填
      • interface - 服务地址,必填
      • version - 注册的服务版本
      • timeout - 超时时间,默认6000
      • group - 分组
      • methodSignature - 方法签名

可以选择使用 js-to-java, 能极大提高效率

var arg={$class:'int',$:123};
//等同于
var arg=java('int',123);