streams-story Pub

Stream tests

Create a named stream. It will be owned by this flow...

val total:Number<-0 send::  msg diesel.stream.new  (stream<-"s1")

Start a generator in same flow send::  msg testdiesel.streams.startGenerator  (stream<-"s1", howMany:Number<-3)

send::  msg diesel.stream.consume  (stream<-"s1", xtimeout:Number<-1000)

expect::  (total is 15)

Batch processing: putAll and onDataSlice

send::  msg diesel.stream.new  (stream<-"s2", batch:Boolean<-true, batchSize:Number<-2)

Start a generator in same flow

send::  msg testdiesel.streams.startGenerator  (stream<-"s2", howMany:Number<-3)

val total:Number<-0 send::  msg diesel.stream.consume  (stream<-"s2", xtimeout:Number<-1000)

expect::  (total is [0,1,2,3,4,5])

Batch stream API

Creating a simple AIP for batch processing of JSON records.

Create a stream, start it up and then call the API with a separate flow to put elements in it.

send::  msg diesel.stream.new  (stream<-"s3")

send::  msg testdiesel.stream.consume  (stream<-"s3", xtimeout:Number<-1000)

send::  msg snakk.text  (url<-"/diesel/rest/putAllInS3", verb<-"POST", body:Array<-[{rec:"rec1",num:1},{rec:"rec2",num:2}])


Was this useful?    

By: Razie | 2020-10-04 | Tags: story , dsl


Viewed 12 times ( | Print ) this page.

You need to log in to post a comment!

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