streams-spec Pub

============ streaming

$when:: (path ~path "/testdiesel/streamsample")
   . (stream="stream${}") (stream)
   testdiesel.streams.generate (stream, howMany:Number=5=5, delay:Number=500=500)
   . (payload=dieselStream)

Diesel streaming features

Start the stream value generators

$when:: testdiesel.streams.startGenerator (stream, howMany)
   testdiesel.streams.generate (stream, howMany)

$when:: testdiesel.streams.generate (stream, howMany, delay?) (stream, data:Number=1=1)
   $ifc:: (delay is defined) ctx.sleep (duration=delay) (stream, data:Number=2=2)
   $ifc:: (delay is defined) ctx.sleep (duration=delay) (stream, data:Number=3=3)
   $ifc:: (delay is defined) ctx.sleep (duration=delay) (stream, data :Array=[..]=[4,5]) (stream)

$when:: (stream == "s1", data)
   ctx.echo (total=total)
   ctx.echo (data=data)
   . (dieselScope[="total"]=(total + data))

$when:: (stream)
   ctx.echo (heh="done ${stream}"="done ${st...)

$when:: (stream == "s2", data)
   ctx.echo (data=data)
   . (dieselScope[="total"]=(total + data))

API based

separate flow to consume

$when:: (stream) (stream)

separate flow to create

$when:: (path ~path "/putAllInS3")
   ctx.echo (data=payload) (stream="s3"="s3", data=payload) (stream="s3"="s3")

TODO when (name, timeout)

$when:: testdiesel.streams.generate (stream, howMany) (stream, data:Number=1=1) (stream, data:Number=2=2)

$when:: testdiesel.crontick
   . (dieselRealm[="testcron"]=(dieselRealm[="testcron"] + 1))
   ctx.echo (x=dieselReal..., y=diesel[="r...)
   . (payload="testcron = ${diesel.realm.props.testcron}")

$when:: testdiesel.crondone (name)
   . (dieselRealm[="testcron"]=(dieselRealm[="testcron"] + name))
   ctx.echo (x=dieselReal..., y=diesel[="r...)
   . (payload="testcron = ${diesel.realm.props.testcron}")

$when:: testdiesel.crontickEX
   . (dieselRealm[="testcronEX"]=(dieselRealm[="testcronEX"] + 1))
   ctx.echo (x=dieselReal..., y=diesel[="r...)
   . (payload="testcron = ${diesel.realm.props.testcronEX}")

Was this useful?    

By: Razie | 2020-10-04 .. 2021-02-02 | Tags: spec , dsl , private

Viewed 467 times ( | History | Print ) this page.

You need to log in to post a comment!

© Copyright DieselApps, 2012-2024, all rights reserved.