All Projects → peak-ai → ais-service-discovery-go

peak-ai / ais-service-discovery-go

Licence: GPL-3.0 license
Cloud application library for Golang

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to ais-service-discovery-go

Condenserdotnet
API Condenser / Reverse Proxy using Kestrel and Consul, Including light weight consul lib
Stars: ✭ 147 (+90.91%)
Mutual labels:  service-discovery
Rssdp
Really Simple Service Discovery Protocol - a 100% .Net implementation of the SSDP protocol for publishing custom/basic devices, and discovering all device types on a network.
Stars: ✭ 216 (+180.52%)
Mutual labels:  service-discovery
go-bmi
Body Mass Index(BMI) application developed by go-chassis microservice framwork
Stars: ✭ 14 (-81.82%)
Mutual labels:  service-discovery
Amalgam8
Content and Version-based Routing Fabric for Polyglot Microservices
Stars: ✭ 152 (+97.4%)
Mutual labels:  service-discovery
Discovery
.NET Clients for Service Discovery and Registration
Stars: ✭ 181 (+135.06%)
Mutual labels:  service-discovery
cloud-functions-boilerplate
An ever-evolving, opinionated architecture, starter kit, and development environment for writing and structuring google cloud functions for firebase.
Stars: ✭ 40 (-48.05%)
Mutual labels:  cloud-functions
Hippo
💨A well crafted go packages that help you build robust, reliable, maintainable microservices.
Stars: ✭ 134 (+74.03%)
Mutual labels:  service-discovery
juno-agent
juno-agent
Stars: ✭ 46 (-40.26%)
Mutual labels:  service-discovery
Express Gateway
A microservices API Gateway built on top of Express.js
Stars: ✭ 2,583 (+3254.55%)
Mutual labels:  service-discovery
opsbro
Ops Best friend
Stars: ✭ 37 (-51.95%)
Mutual labels:  service-discovery
Lighthouse
Lighthouse - a simple service discovery platform for Akka.Cluster (Akka.NET)
Stars: ✭ 164 (+112.99%)
Mutual labels:  service-discovery
Wgsd
A CoreDNS plugin that provides WireGuard peer information via DNS-SD semantics
Stars: ✭ 169 (+119.48%)
Mutual labels:  service-discovery
hnpwa-api
CDN cached Hacker News API
Stars: ✭ 73 (-5.19%)
Mutual labels:  cloud-functions
Asset Scan
asset-scan是一款适用甲方企业的外网资产周期性扫描监控系统
Stars: ✭ 149 (+93.51%)
Mutual labels:  service-discovery
backends-for-android
Sample project to accompany my conference talk "Easy, scalable backends for Android"
Stars: ✭ 19 (-75.32%)
Mutual labels:  cloud-functions
Doge
Doge is a high-performance, Python based, open source RPC framework
Stars: ✭ 144 (+87.01%)
Mutual labels:  service-discovery
container-builder-github-ci-status
Google Cloud Function responds to PubSub events on the cloud-builds topic to update GitHub CI status.
Stars: ✭ 23 (-70.13%)
Mutual labels:  cloud-functions
firebase-swiss
The Firebase Swissknife 🇨🇭
Stars: ✭ 12 (-84.42%)
Mutual labels:  cloud-functions
sample-kotlin-ktor-microservices
sample microservices written in Kotlin that demonstrates usage of Ktor framework woth Consul server
Stars: ✭ 37 (-51.95%)
Mutual labels:  service-discovery
kongsul
Kong Api Gateway with Consul Service Discovery (MicroService)
Stars: ✭ 35 (-54.55%)
Mutual labels:  service-discovery

Cloud Application Framework

This library aims to expose a common set of interfaces for handling common cloud platform tasks. Such as queuing messages, publishing events, calling cloud functions etc.

This library is AWS centric, however, can by modified and extended to support others. Using the interfaces and configuration options shown below.

Being AWS centric, the default options are:

  • Locator / Service Discovery: AWS Cloudmap
  • Request: AWS Lambda
  • Pubsub: AWS SNS
  • Queue: AWS SQS
  • Automate: AWS SSM

Registering a service - Cloudformation

For the Cloudmap locator, the easiest way to register a service is through Cloudformation (or Terraform etc):

CloudMapService:
  Type: AWS::ServiceDiscovery::Service
  Properties:
    Description: User service
    Name: users
    NamespaceId: <namespace-id-here>

CreateUserInstance:
  Type: "AWS::ServiceDiscovery::Instance"
  Properties:
    InstanceAttributes:
      arn: create-user
      handler: create-job-run
      type: function
    InstanceId: create-user
    ServiceId:
      Ref: CloudMapService

Use with default settings

func main() {
  d := discover.NewDiscovery()

  token, err := d.Queue("acme-prod.my-service->my-queue", types.Request{
    Body: []byte("{}"),
  })
  ...
}

Use with custom integrations

func main() {
  ...
  d := discover.NewDiscovery(
    discover.SetQueue(NewKafkaAdapter(kafkaClient)),
    discover.SetPubsub(NewNATSAdapter(natsClient)),
    discover.SetLocator(NewConsulLocator(consul)),
  )
}

Request

d := discover.NewDiscovery()
d.Request("my-namespace.users->create-user", types.Request{
  Body: []byte("{ \"hello\": \"world\" }"),
})

Queue

d := discover.NewDiscovery()
d.Queue("my-namespace.my-service->my-queue", types.Request{
  Body: jsonString,
})

go func() {
  messages, err := d.Listen("my-namespace.my-service->my-queue")
  for message := range message {
    log.Println(string(message.Body))
  }
}()

Pubsub

d := discovery.NewDiscovery()
d.Publish("my-namespace.my-service->my-event", types.Request{
  Body: jsonEvent,
})

Automate

d := discovery.NewDiscovery()
d.Automate("my-namespace.my-service->my-script", types.Request{
  Body: jsonEvent,
})

Custom integrations

You can customise the behaviour and create your own integrations by conforming to the following interfaces, and use the SetLocator, SetQueue, SetPubsub, SetAutomate and SetFunction methods when creating an instance of the Discovery library.

Locator interface

Discover(signature *types.Signature) (*types.Service, error)

Queue interface

// QueueAdapter -
type QueueAdapter interface {

	// Queue a message, return a token or message id
	QueueWithOpts(service *types.Service, request types.Request, opts types.Options) (string, error)
	ListenWithOpts(service *types.Service, opts types.Options) (<-chan *types.Response, error)
}

Function interface

// FunctionAdapter -
type FunctionAdapter interface {
	CallWithOpts(service *types.Service, request types.Request, opts types.Options) (*types.Response, error)
}

AutomateAdapter interface

// AutomateAdapter -
type AutomateAdapter interface {
	ExecuteWithOpts(service *types.Service, request types.Request, opts types.Options) (*types.Response, error)
}

PubsubAdapter interface

// PubsubAdapter -
type PubsubAdapter interface {
	PublishWithOpts(service *types.Service, request types.Request, opts types.Options) error
	SubscribeWithOpts(service *types.Service, opts types.Options) (<-chan *types.Response, error)
}

Acknowledgements: inspired by the amazing work at Micro

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].