nstack / nstack-docs

NStack's documentation on readthedocs
https://nstack.readthedocs.org
0 stars 2 forks source link

Cookbook / Examples #2

Open rjmk opened 7 years ago

rjmk commented 7 years ago

User Stories

Notes from Epic

Examples / 'Cookbook'

Other notes

When we productionise, what are the features we want to show off? Might be cool if we start with a workflow with a subtle bug, productionise and then catch the bug

What is the minimum version of this and a sketch of an iteration plan?

rjmk commented 7 years ago

re: https://github.com/nstackcom/nstack-docs/issues/1#issuecomment-279738143

Yeah, maybe the MVP is the nstack-examples repo

lanthias commented 7 years ago

This will partly be solved by #17, which covers various scenarios, but it would be helpful to have some common examples too.

lanthias commented 7 years ago

Anyone got any cool ideas here? I was thinking things like:

Create a reusable HTTP source that accepts four Doubles

def resusableEndpoint = sources.http : (Double, Double, Double, Double) { http_path = "/endpoint" };

Create a reusable sink which writes to Postgres

def customerSink = sinks.postgres : (Double, Double, Double, Double) { postgres_host = "localhost", pg_database = "db", pg_table = "tbl" };

Connect sources and sinks together directly, without any functions in between

def workflow = reusableEndpoint | customerSink

Create a reusable, partially constructed Postgres source, which has connection parameters specified, but can be reused with multiple queries

def pgPartialSrc = sources.postgres : Text {
  pg_host = "localhost", 
  pg_port = "5432",
  pg_user = "user", 
  pg_password = "123456",
  pg_database = "db"
};

def workflow = pgPartialSrc { pg_query = "SELECT * FROM tbl;" } | myModule.Workflow | sinks.log : Text;

Create a reusable HTTP source which runs all queries through a function

def safeCustomerSource = sources.http : { customerId : Text } { http_path = "/customers" } |  Customers.EnsureCustomerExists;