3. Micro - a toolkit for cloud-native development
• api - API Gateway. A single entry point with dynamic
routing using service discovery.
• bot - Slack and hipchat bot. CLI and ChatOps via
messaging.
• cli - Command line interface. Describe, query and
interact directly from the terminal.
• new - Service template generation. Get started quickly.
• web - Web dashboard to interact via a browser.
4. Go-Micro - A pluggable RPC framework
• Service Discovery - Automatic service registration and
name resolution
• Load Balancing - Client side load balancing built on
discovery
• Message Encoding - Dynamic encoding based on content-
type with protobuf and json support
• Sync Streaming - RPC based communication with support
for bidirectional streaming
• Async Messaging - Native PubSub messaging built in for
event driven architectures
5. API Gateway
- /[service]/[method] # HTTP paths are dynamically mapped to services
- /rpc # Explicitly call a backend service by name and method
6. Service Discovery
The registry provides an interface for service discovery and an
abstraction over varying implementations (consul, etcd, zookeeper, ... )
type Registry interface {
Register(*Service, ...RegisterOption)
error
Deregister(*Service) error
GetService(string) ([]*Service, error)
ListServices() ([]*Service, error)
Watch(...WatchOption) (Watcher, error)
String() string
Options() Options
}
7. Proto Format vs gRPC origin
// The greeting service definition.
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
// The request message containing the user's name.
message HelloRequest {
string name = 1;
}
// The response message containing the greetings
message HelloReply {
string message = 1;
}