moleculer | : rocket : Progressive microservices framework for Node.js | Microservice library

 by   moleculerjs JavaScript Version: 0.14.33 License: MIT

kandi X-RAY | moleculer Summary

kandi X-RAY | moleculer Summary

moleculer is a JavaScript library typically used in Telecommunications, Media, Media, Entertainment, Architecture, Microservice, Nodejs, MongoDB applications. moleculer has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can install using 'npm i @aimomentum/moleculer' or download it from GitHub, npm.

Moleculer is a fast, modern and powerful microservices framework for Node.js. It helps you to build efficient, reliable & scalable services. Moleculer provides many features for building and managing your microservices.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              moleculer has a medium active ecosystem.
              It has 5701 star(s) with 564 fork(s). There are 127 watchers for this library.
              There were 1 major release(s) in the last 12 months.
              There are 43 open issues and 622 have been closed. On average issues are closed in 857 days. There are 12 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of moleculer is 0.14.33

            kandi-Quality Quality

              moleculer has 0 bugs and 0 code smells.

            kandi-Security Security

              moleculer has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              moleculer code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              moleculer is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              moleculer releases are available to install and integrate.
              Deployable package is available in npm.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi has reviewed moleculer and discovered the below as its top functions. This is intended to give you an instant insight into moleculer implemented functionality, and help decide if they suit your requirements.
            • Register common metrics .
            • Generates JSON schemas
            • Wraps action middleware with hooks
            • Updates the common metric metrics .
            • Middleware for single Bulkhead
            • Watch the files in the project
            • Wrapper for bulk action requests .
            • Wrapper function to make local action middleware
            • Wrapper for tracing event handlers
            • Wrapper around request middleware logic with retry logic
            Get all kandi verified functions for this library.

            moleculer Key Features

            No Key Features are available at this moment for moleculer.

            moleculer Examples and Code Snippets

            How to use it
            JavaScriptdot img1Lines of Code : 72dot img1no licencesLicense : No License
            copy iconCopy
            HelloWorld:
                name: "serverless-moleculer-hello-world"
                handler: handler.HelloWorld
                memorySize: 256
                timeout: 30
                events:
                  - http:
                      path: /
                      method: any
                      cors:
                        origin: '*'
                        headers  
            Usage,Handle socket events
            TypeScriptdot img2Lines of Code : 37dot img2License : Permissive (MIT)
            copy iconCopy
            const IO = require('socket.io')
            const { ServiceBroker } = require('moleculer')
            const SocketIOService = require('moleculer-io')
            
            const broker = new ServiceBroker({
              logger: console,
              metrics:true,
              validation: true
            })
            
            broker.createService({
            	name:  
            Usage with moleculer-runner,Usage with custom ServiceFactory class
            TypeScriptdot img3Lines of Code : 29dot img3License : Permissive (MIT)
            copy iconCopy
            const moleculer = require('moleculer');
            const { Service, Action } = require('moleculer-decorators');
            
            // create new service factory, inheriting from moleculer native Service
            class CustomService extends moleculer.Service {
                constructor(broker, sche  

            Community Discussions

            QUESTION

            Using moleculer for microservices in monolith
            Asked 2022-Jan-12 at 13:54

            I am in the process of implementing the backend for a business idea in moleculer microservice framework. It works quite well for now using the NATS transporter.

            In the near future the number of messages will stay quite low (compared to this example in moleculer documentation) and scaling won't be an issue for now. Therefor In-Memory communication should not be an issue and I would like to remove the whole transporter overhead.

            My motivation to use a microservice framework is loose coupling for a clean separation of responsibilities and the option to scale in the future with low effort.

            Are there any major disadvantages in using the monolithic architecture for early stage projects or should I directly implement it as a "One service - one/multiple node(s)"-solution? The official documentation describes multiple architectures.

            Any practical experience is highly appreciated!

            ...

            ANSWER

            Answered 2022-Jan-12 at 13:54

            No, this is the biggest advantage of the Moleculer framework, that you can run all services on one node as a monolith while you have no big traffic. And if the traffic grows, you can start to separate the services into groups and make replicas if need (without modification in services codes).

            Source https://stackoverflow.com/questions/70681932

            QUESTION

            MoleculerJs with Jaeger tracing: how to trace follow up action calls (new spans) in one trace
            Asked 2021-Jun-14 at 21:33

            I would like to display all my traces like in the examples from the moleculer-jaeger package:

            But what i get is something like this: All spans you can see in this picture should be within the main trace (gateway).

            Here is my moleculer.config:

            ...

            ANSWER

            Answered 2021-Jun-14 at 21:33
            1. This version already has a built-in jager tracer, see the documentation.
            2. In order for the events to be nested, it is necessary to transfer the context inside the actions, use ctx.call calls instead of broker.call, so they will be nested.
            3. To quickly receive support for the moleculer, join us in discord!

            Source https://stackoverflow.com/questions/67967551

            QUESTION

            What is the best approach to stream JSON from a REST API to an Express app?
            Asked 2021-May-27 at 05:17

            I have a moleculer-based microservice that has an endpoint which outputs a large JSON object (around tens of thousands of objects)

            This is a structured JSON object and I know beforehand what it is going to look like.

            ...

            ANSWER

            Answered 2021-May-15 at 05:57

            Are you asking for a general approach recommendation, or for support with the particular solution you have?

            If it's for the first, then I think your best bet for communicating between the server and the client is through websockets, perhaps with something like Socket.io. A long lived connection will serve you well here, since it will take a long time to transmit all your data across.

            Then you can send data from the server to the client any time you like. At that point you can read your data on the server as a node.js stream and emit the data one at a time.

            The problem with using Oboe and writing to the response on every node is that it requires a long running response, and there's a high likelihood the connection could get interrupted before you've sent all the data across.

            Source https://stackoverflow.com/questions/67528026

            QUESTION

            Sanitizing JSON in Javascript: smart-removal of double quotes
            Asked 2021-Apr-23 at 08:05

            I get some JSON from a moleculer.js return call that looks like this:

            ...

            ANSWER

            Answered 2021-Apr-23 at 08:05

            Turns out the easiest solution found so far (at the time of this writing) is to just re-parse the value string back into JSON and concatenate it into a new JSON.

            Example code:

            Source https://stackoverflow.com/questions/67110486

            QUESTION

            Moleculer metrics port not exposed in docker container
            Asked 2021-Mar-19 at 08:01

            I'm using molecule for microservices. Actually I don't know how to expose the metrics port (3030) in the docker container to be able to read metrics from http://host:3030/metrics

            when the app is executed ion my localhost it is working just fine but when deploying with docker-compose --build -up it don't work.

            my docker compose traefik section ...

            ANSWER

            Answered 2021-Mar-11 at 16:00

            Are you using Prometheus as exporter? If that's the case then please check https://github.com/AndreMaz/moleculer-prometheus-demo

            Source https://stackoverflow.com/questions/66583822

            QUESTION

            Constructing Context Object in MoleculerJS
            Asked 2021-Mar-15 at 20:45

            I'm having trouble understanding the basic concept of MoleculerJS. I have a method called when a SQS message received.

            ...

            ANSWER

            Answered 2021-Mar-15 at 20:45

            lifecycle methods don't have any input params meaning that you don't have context object by default.

            However, you can use await this.broker.call("service.name", {data}) and call another service.

            Source https://stackoverflow.com/questions/66613677

            QUESTION

            How to running independently docker images with moleculer instead using "compose up"?
            Asked 2021-Feb-22 at 12:17

            I have got this docker-compose.yaml. It defines 1 service with the public API and 4 services (replicated) with another two microservices each one (one receives events and another one saves info to mongo). This works perfectly when i do "docker-compose up". But I want to run each images with "docker run".

            ...

            ANSWER

            Answered 2021-Feb-22 at 12:17

            Just set the env vars in docker run, as well

            E.g.

            Source https://stackoverflow.com/questions/66312669

            QUESTION

            Setting up infraestructure using moleculer and kubernetes (doubts)
            Asked 2021-Feb-19 at 18:40

            I am testing moleculer microservices framework to setting up an infraestructure. I will to use typescript (https://github.com/moleculerjs/moleculer-template-project-typescript). My idea is according the documentation is:

            • create one project for with API Gateway => make doker => make k8s deployment with N replicas
            • create 1 project per microservice => dockerize => make k8s deployment with N replicas
            • create 2 project per microservice => dockerize => make k8s deployment with N replicas ...
            • create N project per microservice => dockerize => make k8s deployment with N replicas

            I will use redis as transporter. I want to use redis also in development.

            I have got this doubt, because you can create in the same project all the microservices, but in this way, you are developing a monolitic application (and only in one thread). I think that you need to sepparate each microservice in independent (typescripts) projects to make it after docker images and the make pods in k8s in the deployment phase.

            ...

            ANSWER

            Answered 2021-Feb-19 at 10:04

            You can separate every microservices into a separated projects, but with Moleculer you don't need it. You can put all services into one project. The development will be easy and fast, and at deploying you can control which services will be loaded. So you can generate one docker image and control the loaded services with environment variables.

            E.g here you can see the SERVICES env var in docker-compose.yml: https://moleculer.services/docs/0.14/deploying.html#Docker-Compose

            Source https://stackoverflow.com/questions/66275042

            QUESTION

            Getting `undefined` value even after attaching socket to `ctx` in `beforeCall()` hook in moleculer.io
            Asked 2021-Feb-12 at 15:22

            I am using moleculerjs to handle microservices on the backend, and with one of the front-end applications I am handling the communication over sockets. To do that I am using moleculer.io. The problem I'm running into is that, even though I am attaching the socket to ctx in the onBeforeCall() hook, the socket is not there when I console.log ctx in the controller function.

            My gateway looks like this (notice the socket is being added to the ctx object in the onBeforeCall() hook:

            ...

            ANSWER

            Answered 2021-Feb-12 at 14:01

            You can't do that. You can't put anything to the ctx. The ServiceBroker will serialize & transfer only the ctx.params and ctx.meta properties. But you can't put the socket into them because the Socket object what you like is not serializable, so you can't access it in remote services. It can work in a monolith project, not in a microservices project.

            Source https://stackoverflow.com/questions/66172801

            QUESTION

            NATS with moleculer. How can I change NATS max_payload value?
            Asked 2021-Jan-09 at 18:38

            My problem is that I need to increase max_payload value that NATS receive but I have no idea where I can do it.

            The project is using Moleculer and NATS is created as a container with docker.

            When I try to make a request which is bigger than 1MB NATS returns:

            ...

            ANSWER

            Answered 2021-Jan-09 at 09:08

            You should create a configuration file for NATS. And push it to the container as a Docker volume and set the command as -c nats-server.conf

            nats-server.conf

            Source https://stackoverflow.com/questions/65638631

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install moleculer

            You can install using 'npm i @aimomentum/moleculer' or download it from GitHub, npm.

            Support

            Moleculer is an open source project. It is free to use for your personal or commercial projects. However, developing it takes up all our free time to make it better and better on a daily basis. If you like Moleculer framework, please support it.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • npm

            npm i moleculer

          • CLONE
          • HTTPS

            https://github.com/moleculerjs/moleculer.git

          • CLI

            gh repo clone moleculerjs/moleculer

          • sshUrl

            git@github.com:moleculerjs/moleculer.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link