github.com/moleculer-go/moleculer@v0.3.3/README.md (about)

     1  # Moleculer Go
     2  
     3  🚀 Progressive microservices framework for Go
     4  <img src="https://moleculer-go-site.herokuapp.com/images/moleculer-gopher-no-bg.png" alt="Moleculer Gopher" height="65"/>
     5  <img src="https://golang.org/doc/gopher/frontpage.png" alt="Gopher" height="65"/>
     6  
     7  Inspired and compatible with [Moleculer JS](https://github.com/moleculerjs/moleculer)
     8  
     9  Simple, fast, light and fun to develop with. Also easy, very easy to test ;)
    10  
    11  [![Gitter](https://badges.gitter.im/moleculer-go/community.svg)](https://gitter.im/moleculer-go/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
    12  [![Drone.io Build Status](https://cloud.drone.io/api/badges/moleculer-go/moleculer/status.svg)](https://cloud.drone.io/moleculer-go/moleculer)
    13  [![Go Report Card](https://goreportcard.com/badge/github.com/moleculer-go/moleculer)](https://goreportcard.com/report/github.com/moleculer-go/moleculer)
    14  [![Coverage -> Coveralls](https://coveralls.io/repos/github/moleculer-go/moleculer/badge.svg?branch=master)](https://coveralls.io/github/moleculer-go/moleculer?branch=master)
    15  [![Coverage -> Codecov](https://codecov.io/gh/moleculer-go/moleculer/branch/develop/graph/badge.svg)](https://codecov.io/gh/moleculer-go/moleculer)
    16  <a href="https://app.fossa.com/projects/git%2Bgithub.com%2Fmoleculer-go%2Fmoleculer?ref=badge_shield" alt="FOSSA Status"><img src="https://app.fossa.com/api/projects/git%2Bgithub.com%2Fmoleculer-go%2Fmoleculer.svg?type=shield"/></a>
    17  
    18  # Get Started
    19  
    20  - [http://gomicro.services (Official site and Documentation)](http://gomicro.services)
    21  - [Database examples](https://moleculer-go-site.herokuapp.com/docs/0.1/store.html)
    22  
    23  ## Example
    24  
    25  ```go
    26  package main
    27  
    28  import (
    29  	"fmt"
    30  
    31  	"github.com/moleculer-go/moleculer"
    32  	"github.com/moleculer-go/moleculer/broker"
    33  )
    34  
    35  type MathService struct {
    36  }
    37  
    38  func (s MathService) Name() string {
    39  	return "math"
    40  }
    41  
    42  func (s *MathService) Add(params moleculer.Payload) int {
    43  	return params.Get("a").Int() + params.Get("b").Int()
    44  }
    45  
    46  func (s *MathService) Sub(a int, b int) int {
    47  	return a - b
    48  }
    49  
    50  func main() {
    51  	var bkr = broker.New(&moleculer.Config{LogLevel: "error"})
    52  	bkr.Publish(&MathService{})
    53  	bkr.Start()
    54  	result := <-bkr.Call("math.add", map[string]int{
    55  		"a": 10,
    56  		"b": 130,
    57  	})
    58  	fmt.Println("result: ", result.Int())
    59  	//$ result: 140
    60  	bkr.Stop()
    61  }
    62  ```
    63  
    64  # Roadmap
    65  
    66  ## v0.1.0 (MVP)
    67  
    68  **Contents:**
    69  
    70  - Service Broker
    71  - Transit and Transport
    72  - Actions (request-reply)
    73  - Events
    74  - Mixins
    75  - Load balancing for actions and events (random round-robin)
    76  - Service registry & dynamic service discovery
    77  - Versioned services
    78  - Middlewares
    79  - NATS Streaming Transporter
    80  - JSON Serializer
    81  - Examples :)
    82  
    83  ## v0.2.0 (Beta RC1)
    84  
    85  - Action validators
    86  - Support for streams
    87  - More Load balancing implementations (cpu-usage, latency)
    88  - Fault tolerance features (Circuit Breaker, Bulkhead, Retry, Timeout, Fallback)
    89  - Built-in caching solution (memory, Redis)
    90  - More transporters (gRPC, TCP, Redis, Kafka)
    91  - More serializers (Avro, MsgPack, Protocol Buffer, Thrift)
    92  
    93  ## v0.3.0 (Beta)
    94  
    95  - Performance and Optimization
    96  - More DB Adaptors (Firebase, MySQL)
    97  - CLI for Project Seed Generation
    98  
    99  ## v0.4.0 (Alpha)
   100  
   101  - Event Sourcing Mixins
   102  
   103  ## v0.5.0 (Release)
   104  
   105  # Installation
   106  
   107  ```bash
   108  $ go get github.com/moleculer-go/moleculer
   109  ```
   110  
   111  # Running examples
   112  
   113  ```bash
   114  
   115  # simple moleculer db example with memory adaptor
   116  $ go run github.com/moleculer-go/store/examples/users
   117  
   118  # simple moleculer db example with Mongo adaptor
   119  $ go run github.com/moleculer-go/store/examples/usersMongo
   120  
   121  # simple moleculer db example with SQLite adaptor
   122  $ go run github.com/moleculer-go/store/examples/usersSQLite
   123  
   124  # complex moleculer db example with population of fields by other services
   125  $ go run github.com/moleculer-go/store/examples/populates
   126  
   127  
   128  ```
   129  
   130  # Running tests
   131  
   132  
   133  ```
   134  # integration tests require mongo, nats streaming and rabbitmq
   135  
   136  # run mongo
   137  docker run -d -p 27017:27017 mongo
   138  
   139  # run nats-streaming
   140  docker run -d -p 4222:4222 nats-streaming -mc 0
   141  
   142  
   143  # run rabbitmq
   144  docker run -d -p 5672:5672 rabbitmq
   145  
   146  # running all tests
   147  go test ./...
   148  # or
   149  ginkgo -r
   150  ```