semaphore

package module
v0.0.0-...-3cc3ff2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2021 License: MIT Imports: 12 Imported by: 0

README

Semaphore CI


Take control of your data, connect with anything, and expose it anywhere through protocols such as HTTP, GraphQL, and gRPC!

Create advanced and high performing data flows and expose them through endpoints over multiple protocols such as HTTP, GraphQL, and gRPC. Create custom extensions or use the availability of custom functions and protocol implementations.

Key features of Semaphore are:

  • 🔗 Connect with anything Use the right tool for the job. Semaphore supports various protocols out of the box with the ability to supporting additional protocols through modules. Endpoints could be created to expose a single flow through multiple protocols.

  • 🚀 Blazing fast Semaphore scales up to your needs. Branches are created to execute resources concurrently. Branches are based on dependencies between resources made through references or hard coded values. Creating high-performance flows is almost boringly easy.

  • ✅ Transactional flows Make sure that your data stays consistent. Rollback data when an unexpected response is returned from one of your services. References to returned values could be made allowing to ensure that your customers have the best experience possible.

  • ⛩️ Conditional logic Only call services when needed. Conditional expressions ensure that resources are only executed when needed. Conditions grow to your needs. Whether you want to keep things simple or need to achieve complex goals.

  • 🌍 Adapts to your environment Semaphore integrates with your existing system(s). Define flows through simple and strict typed definitions. Use your already existing schema definitions such as Protobuffers. Or extend Semaphore with custom modules and proprietary software. Integrate services through flow definitions and create a great experience for your customers and your teams.


asciicast

Enterprise

Want to take your systems to the next level? Semaphore Enterprise allows users to fully embrace the power their data flows. Additional modules and tooling allows users to build more complex environments and helps running Semaphore in production.

Feel free to request for more information or a demo by sending us a email at: support@jexia.com

Documentation and Getting Started

Documentation is available at Github pages.

If you are new to Semaphore and want to get started with building flows, please check out the available 🚀 Examples. Feel free to reach out to the community on Discord or by opening a new issue.

Data streams inside Semaphore are defined as flows. A flow could manipulate, deconstruct, and forwarded data in between resources. Flows are exposed through endpoints. Flows are generic and could handle different protocols and codecs from a single flow. All flows are strictly typed through schema definitions. These schemas define the contracts provided and accepted by services.

Currently, are only protobuffers supported but more schema definitions are planned to be supported in the future. Feel free to open a new issue to discuss which schema definition you require.

endpoint "checkout" "http" {
	endpoint = "/cart/checkout"
	method = "POST"
}

endpoint "checkout" "grpc" {
	package = "webshop.cart"
	service = "Payment"
	method = "Checkout"
}

flow "checkout" {
	input "services.Order" {}

	resource "product" {
		request "services.Warehouse" "GetProduct" {
			product = "{{ input:product }}"
		}
	}

	resource "shipping" {
		request "services.Warehouse" "Send" {
			user = "{{ input:user }}"
		}
	}

	output "services.OrderResult" {
		status = "{{ shipping:status }}"
		product = "{{ product:. }}"
	}
}
Installing Semaphore

There are variouse sources available to download and install the ⚡ Semaphore CLI. For more information and install methods please check out the installing section.

$ curl https://raw.githubusercontent.com/jexia/semaphore/master/install.sh | sh

Install Semaphore

Developing Semaphore

If you wish to work on Semaphore itself or any of its built-in systems, you'll first need Go installed on your machine. Go version 1.13.7+ is required.

For local dev first make sure Go is properly installed, including setting up a GOPATH. Ensure that $GOPATH/bin is in your path as some distributions bundle old version of build tools. Next, clone this repository. Semaphore uses Go Modules, so it is recommended that you clone the repository outside of the GOPATH. You can then download any required build tools by bootstrapping your environment:

$ make bootstrap
...

To compile a development version of Semaphore, run make or make dev. This will put the Semaphore binary in the bin folders:

$ make dev
...
$ bin/semaphore
...

To run tests, type make test. If this exits with exit status 0, then everything is working!

$ make test
...

Contributing

Thank you for your interest in contributing to Semaphore! ❤ Check out the open projects and/or issues and feel free to join any ongoing discussion.

Everyone is welcome to contribute, whether it's in the form of code, documentation, bug reports, feature requests, or anything else. We encourage you to experiment with the project and make contributions to help evolve it to meet your needs!

See the contributing guide for more details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetOptions

func SetOptions(ctx *broker.Context, parent *Options, options ...Option) error

SetOptions sets the given options in the given parent

Types

type AfterFlowConstruction

type AfterFlowConstruction func(*broker.Context, specs.FlowInterface, *flow.Manager) error

AfterFlowConstruction is called before the construction of a flow manager

type AfterFlowConstructionHandler

type AfterFlowConstructionHandler func(AfterFlowConstruction) AfterFlowConstruction

AfterFlowConstructionHandler wraps the before flow construction function to allow middleware to be chained

type BeforeConstructor

type BeforeConstructor func(*broker.Context, functions.Collection, Options) error

BeforeConstructor is called before the specifications is constructored

type BeforeConstructorHandler

type BeforeConstructorHandler func(BeforeConstructor) BeforeConstructor

BeforeConstructorHandler wraps the before constructed function to allow middleware to be chained

type Middleware

type Middleware interface {
	Use(*broker.Context) ([]Option, error)
}

Middleware is called once the options have been initialised

func MiddlewareFunc

func MiddlewareFunc(handle func(*broker.Context) ([]Option, error)) Middleware

MiddlewareFunc wraps the given handle inside a middleware implementation

type Option

type Option func(*broker.Context, *Options)

Option represents a constructor func which sets a given option

func AfterFlowConstructor

func AfterFlowConstructor(wrapper AfterFlowConstructionHandler) Option

AfterFlowConstructor the passed function gets called before a flow manager gets constructed

func AfterManagerDo

func AfterManagerDo(wrapper flow.AfterManagerHandler) Option

AfterManagerDo the passed function gets after a flow has been handled by the flow manager

func AfterManagerRollback

func AfterManagerRollback(wrapper flow.AfterManagerHandler) Option

AfterManagerRollback the passed function gets after a flow rollback has been handled by the flow manager

func AfterNodeDo

func AfterNodeDo(wrapper flow.AfterNodeHandler) Option

AfterNodeDo the passed function gets called after a node is executed

func AfterNodeRollback

func AfterNodeRollback(wrapper flow.AfterNodeHandler) Option

AfterNodeRollback the passed function gets called after a node rollback is executed

func BeforeManagerDo

func BeforeManagerDo(wrapper flow.BeforeManagerHandler) Option

BeforeManagerDo the passed function gets called before a request gets handled by a flow manager

func BeforeManagerRollback

func BeforeManagerRollback(wrapper flow.BeforeManagerHandler) Option

BeforeManagerRollback the passed function gets called before a rollback request gets handled by a flow manager

func BeforeNodeDo

func BeforeNodeDo(wrapper flow.BeforeNodeHandler) Option

BeforeNodeDo the passed function gets called before a node is executed

func BeforeNodeRollback

func BeforeNodeRollback(wrapper flow.BeforeNodeHandler) Option

BeforeNodeRollback the passed function gets called before a node rollback is executed

func NewCollection

func NewCollection(options ...Option) []Option

NewCollection constructs a new options collection

func WithBeforeConstructor

func WithBeforeConstructor(wrapper BeforeConstructorHandler) Option

WithBeforeConstructor the passed function gets called before new specifications are constructed

func WithCaller

func WithCaller(caller transport.NewCaller) Option

WithCaller appends the given caller to the collection of available callers

func WithCodec

func WithCodec(codec codec.Constructor) Option

WithCodec appends the given codec to the collection of available codecs

func WithFlows

func WithFlows(definition providers.FlowsResolver) Option

WithFlows appends the given flows resolver to the available flow resolvers

func WithFunctions

func WithFunctions(custom functions.Custom) Option

WithFunctions defines the custom defined functions to be used

func WithLogLevel

func WithLogLevel(pattern string, value string) Option

WithLogLevel sets the log level for the given module

func WithMiddleware

func WithMiddleware(middleware Middleware) Option

WithMiddleware initialises the given middleware and defines all options

type Options

type Options struct {
	Codec                 codec.Constructors
	Callers               transport.Callers
	FlowResolvers         providers.FlowsResolvers
	Middleware            []Middleware
	BeforeConstructor     BeforeConstructor
	BeforeManagerDo       flow.BeforeManager
	BeforeManagerRollback flow.BeforeManager
	AfterManagerDo        flow.AfterManager
	AfterManagerRollback  flow.AfterManager
	BeforeNodeDo          flow.BeforeNode
	BeforeNodeRollback    flow.BeforeNode
	AfterNodeDo           flow.AfterNode
	AfterNodeRollback     flow.AfterNode
	AfterFlowConstruction AfterFlowConstruction
	Functions             functions.Custom
}

Options represents all the available options

func NewOptions

func NewOptions(ctx *broker.Context, options ...Option) (Options, error)

NewOptions constructs a Options object from the given Option constructors

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL