Git Product home page Git Product logo

go-sdk-examples's Introduction

Go QuickStart Example

This repository contains sample applications that demonstrates the various features of Conductor Go SDK.

SDK Features

Go SDK for Conductor allows you to:

  1. Create workflow using Code
  2. Execute workflows
  3. Create workers for task execution and framework (TaskRunner) for executing workers and communicating with the server.
  4. Support for all the APIs such as
    1. Managing tasks (poll, update etc.),
    2. Managing workflows (start, pause, resume, terminate, get status, search etc.)
    3. Create and update workflow and task metadata
    4. User and event management

Running Example

Note Obtain KEY and SECRET from the playground or your Conductor server. Quick tutorial for playground

Export variables

export KEY=
export SECRET=
export CONDUCTOR_SERVER_URL=https://play.orkes.io/api

Run the main program

go run main.go

Workflow

We create a simple 2-step workflow that fetches the user details and sends an email.

VisualCode
 
func CreateWorkflow() *workflow.ConductorWorkflow {
	return workflow.NewConductorWorkflow(workflowExecutor).
		Name("user_notification").
		Version(1).
		InputParameters("userId", "notificationPref").
		Add(workflow.NewSimpleTask("get_user_info", "get_user_info").Input("userId", "${workflow.input.userId}")).
        Add(workflow.NewSwitchTask("emailorsms", "${workflow.input.notificationPref}"))
}

Worker

Workers are a simple interface implementation. See workers.go for more details.

Executing Workflows

There are two ways to execute a workflow:

  1. Synchronously - useful for short duration workflows that completes within a few second.
  2. Asynchronously - workflows that runs for longer period

Synchronous Workflow Execution

ConductorWorkflow#ExecuteWorkflow(...)

Asynchronous Workflow Execution

ConductorWorkflow#StartWorkflow(...)

See main.go for complete code sample of workflow execution.

go-sdk-examples's People

Contributors

gardusig avatar v1r3n avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.