Code Monkey home page Code Monkey logo

moleculer-go's Introduction

moleculer-go

This is Moleculer implementation for go (>=1.9.x). Currently only support NATS as transporter.

moleculer(nodejs) info :

Moleculer is a fast, modern and powerful microservices framework for NodeJS (>= v6.x).

Moleculer: https://github.com/ice-services/moleculer

Website: https://moleculer.services

Documentation: https://moleculer.services/docs

How to use, refer to example :

run:

go run .\examples\moleculer-go-demo.go -s nats://192.168.1.69:12008

output:

INFO[09-28 14:37:19.580887] broker.Call demoService.actionA start
INFO[09-28 14:37:19.581886] run actionA, req.Params = map[arg2:123 arg1:aaa]
INFO[09-28 14:37:19.582886] broker.Call demoService.actionA end, res: map[res1:AAA res2:123]
INFO[09-28 14:37:19.582886] broker.Call demoService.actionA end, err: <nil>
INFO[09-28 14:37:19.582886] broker.Call demoService.actionB start
INFO[09-28 14:37:19.582886] run actionB, req.Params = map[arg1:bbb arg2:456]
INFO[09-28 14:37:19.583886] broker.Call demoService.actionB end, res: map[res2:456 res1:BBB]
INFO[09-28 14:37:19.583886] broker.Call demoService.actionB end, err: <nil>
INFO[09-28 14:37:19.583886] broker.Emit user.create start
INFO[09-28 14:37:19.583886] broker.Emit user.create end, err: <nil>
INFO[09-28 14:37:19.583886] broker.Broadcast user.delete start
INFO[09-28 14:37:19.583886] broker.Broadcast user.delete end, err: <nil>
INFO[09-28 14:37:19.583886] run onEventUserCreate, req.Data = map[user:userA status:create]
INFO[09-28 14:37:19.583886] run onEventUserDelete, req.Data = map[user:userB status:delete]

Performance

ENV: one receiver process and one sender process on WIN10(i7-2600), NATS Server on Ubuntu Server 14.04(i7-4790K)

broker.Call demoService.bench goroutineNum[1] callCount[10000] use[6.0100862s] req/s[1663] minLatency[999.9µs] maxLatency[5.0021ms]
broker.Call demoService.bench goroutineNum[5] callCount[50000] use[5.9192496s] req/s[8447] minLatency[999.9µs] maxLatency[10.0015ms]
broker.Call demoService.bench goroutineNum[10] callCount[100000] use[6.3480519s] req/s[15752] minLatency[1.0002ms] maxLatency[12.0096ms]
broker.Call demoService.bench goroutineNum[50] callCount[500000] use[10.052548s] req/s[49738] minLatency[1ms] maxLatency[25.0064ms]

Status :

Not support REQB and EVENTB right now. Please KEEP disableBalancer: false in nodejs moleculer

v0.5.0

Now use Moleculer Protocol Version = "3"

  • MOL.DISCOVER
  • MOL.DISCOVER.nodeID
  • MOL.INFO
  • MOL.INFO.nodeID
  • MOL.HEARTBEAT
  • MOL.REQ.nodeID
  • MOL.REQB.action
  • MOL.RES.nodeID
  • MOL.EVENT.nodeID
  • MOL.EVENTB.event
  • MOL.PING
  • MOL.PING.nodeID
  • MOL.PONG.nodeID
  • MOL.DISCONNECT
  • internal $node.xxx

moleculer-go's People

Contributors

roytan883 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

coerick igk1972

moleculer-go's Issues

Install deps

Hi,

I cloned the repo, but how can I install dependencies?

golang=>nodejs

Hello! Does is it support events emitted from golang to nodejs? I try emit event and subscribe to it in nodejs project.
In ,my case it returns
level=error msg="Service Not available: device.connected"
in go:
err = pBroker.Emit("device.connected", map[string]interface{}{ "ID": "asdasd", })
in node:
const myService = { name: "myService", events: { "device.connected"(device) { console.log(device) }, "**"(payload, sender, event) { console.log(Event '${event}' received from ${sender} node:`, payload)
}
},
};

`

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.