<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Łukasz Kamieniecki-Mruk</title>
    <description>The latest articles on Forem by Łukasz Kamieniecki-Mruk (@luccamscr).</description>
    <link>https://forem.com/luccamscr</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F739035%2F690bedb6-cc42-4deb-8161-b79554e620a3.png</url>
      <title>Forem: Łukasz Kamieniecki-Mruk</title>
      <link>https://forem.com/luccamscr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/luccamscr"/>
    <language>en</language>
    <item>
      <title>Scramjet Transform Hub — Quick Start introduction</title>
      <dc:creator>Łukasz Kamieniecki-Mruk</dc:creator>
      <pubDate>Thu, 28 Oct 2021 16:35:17 +0000</pubDate>
      <link>https://forem.com/scramjetorg/scramjet-transform-hub-quick-start-introduction-3dfb</link>
      <guid>https://forem.com/scramjetorg/scramjet-transform-hub-quick-start-introduction-3dfb</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Scramjet Transform Hub - Quick Start introduction&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Scramjet Transform Hub allows you to deploy and run multiple data processing apps called sequences. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Sequences&lt;/strong&gt; are specific apps, not just any apps. They specialize in the efficient data processing.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;STH can be treated both as a data processing engine and execution platform for multiple sequences running on the same platform and performing various data processing tasks. &lt;/p&gt;

&lt;p&gt;We named our apps "sequences" and that term describes well its nature, as they process data through a sequence of chained functions. Therefore usually, our sequences are concise and easy to write ,and powerful at the same time.&lt;/p&gt;

&lt;p&gt;Our vanilla STH engine is based on Node.js and thus allows developers to benefit from the rich ecosystem and many packages and solutions provided by this vibrant community.&lt;/p&gt;

&lt;p&gt;The core part of our STH engine is called the "host". &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The &lt;strong&gt;Host&lt;/strong&gt; is responsible for maintaining and deploying sequences, keeping them running, and managing their lifecycle. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Host exposes also its own REST API to provide and receive data and manage sequences and host itself.&lt;/p&gt;

&lt;p&gt;What we also do on the host level is that we apply a set of algorithms to optimize and speed up data processing execution in sequences. &lt;/p&gt;

&lt;p&gt;You can interact with the host using our dedicated STH CLI that will help you with both sequences deployment, running it and monitoring.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;2. Solution concept diagram&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GTY_GfV8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xdad8s2t2m3mtvw5od9v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GTY_GfV8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xdad8s2t2m3mtvw5od9v.png" alt="Scramjet Transform Hub data flows" width="880" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;2.1 Inputs&lt;/strong&gt;
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;STH can handle any input that can be handled by Node.js application. &lt;/li&gt;
&lt;li&gt;You, as a developer, are free to process a variety of inputs in your sequence applications, such as: Text, JSON, XML, SOAP, Audio, Video, and more.&lt;/li&gt;
&lt;li&gt;Inputs can be either:

&lt;ul&gt;
&lt;li&gt;Provided to STH via its REST API; or&lt;/li&gt;
&lt;li&gt;Consumed from various local or remote sources by the app; such as Stream, STDIN, File, API, URL&lt;/li&gt;
&lt;li&gt;Generated by the app itself&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;2.2 Host&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;This is a solution central processing and management unit with the following major components:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;Sequences&lt;/strong&gt; - these are the actual "STH" apps. It is a gzipped package (&lt;code&gt;*.tar.gz&lt;/code&gt;) containing at least two files:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;package.json&lt;/strong&gt; - JSON manifest file describing the app and its configuration such as the main file to run&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;main file&lt;/strong&gt; - file such as index.js or index.ts that contains lightweight application business logic.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instance&lt;/strong&gt; - once the sequence is run, the host will create a separate runtime environment for it and will execute sequence code inside this runtime entity. This is an instance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API &amp;amp; CLI&lt;/strong&gt; - our Application Programming Interface and CLI connecting to it allows both for &lt;strong&gt;Data operations&lt;/strong&gt; (sending input data and receiving output data) and &lt;strong&gt;Management operations&lt;/strong&gt; (manage host itself and its entities: sequences or instances)&lt;/li&gt;
&lt;/ol&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;2.3 Outputs&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Our engine outputs can be managed in several ways: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;File&lt;/strong&gt; - you can save your output to the local or remote file&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;STDOUT&lt;/strong&gt; - output can be directed to system STDOUT (STERR is supported as well)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API&lt;/strong&gt; - output can be consumed from our  STH REST API&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;URL Request&lt;/strong&gt; - you can write your app in a way to request URL, webhook, etc&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stream&lt;/strong&gt; - output can be streamed to a particular destination&lt;/li&gt;
&lt;li&gt;you can mix multiple actions together: you can both send data to a remote system/URL and save it locally.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;3 Install Scramjet Transform Hub&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;3.1 Prepare environment&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In order to install Scramjet Transform Hub, please follow these 3 steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Get Linux machine (local UNIX/Linux OS, cloud VM , etc)&lt;/li&gt;
&lt;li&gt;Install Docker on this Linux machine (&lt;a href="https://docs.docker.com/get-docker/"&gt;official Docker instructions are here&lt;/a&gt;) &lt;/li&gt;
&lt;li&gt;Install npm on this machine (&lt;a href="https://nodejs.org/"&gt;official instructions are here&lt;/a&gt;). Currently, we recommend Node.js version 14.x LTS.
### &lt;strong&gt;3.2 Install STH&lt;/strong&gt;
Open one Linux terminal window and issue the following commands:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;1. Install Scramjet Transform Hub and  STH CLI&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i &lt;span class="nt"&gt;-g&lt;/span&gt; @scramjet/sth @scramjet/cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Run STH&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;scramjet-transform-hub
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;4 Run your first sequence&lt;/strong&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;4.1 Review the package&lt;/strong&gt;
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;Note that all commands here are executed from the root of this repository&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We have prepared for you a simple "hello-snowman" sequence that you can use. This sequence is available in the directory &lt;code&gt;samples/hello-snowman&lt;/code&gt; in this repository.&lt;br&gt;
In this directory you will find two files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;package.json&lt;/code&gt; - the manifest file that describes this particular sequence&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;index.js&lt;/code&gt; - file containing main application logic.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This particular application is written in plain JavaScript to simplify this example. However, you can also write your sequences in TypeScript and build them before packaging and sending the sequence to STH.&lt;/p&gt;

&lt;p&gt;There is no need to change anything in our &lt;code&gt;hello-snowman&lt;/code&gt; sequence for a first run. Let's move to the next step.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;4.2 Prepare and send sequence package&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Our "sequence" apps need to be packaged before can be sent to Transform Hub. This package is a simple TAR archive and our STH CLI has a special command to package the app directory into sequence tarball.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; any time, you can display STH CLI help by issuing terminal command &lt;code&gt;si help&lt;/code&gt; (for general help) or &lt;code&gt;si &amp;lt;command&amp;gt; help&lt;/code&gt; for specific command (ie. &lt;code&gt;si sequence help&lt;/code&gt;)&lt;/p&gt;

&lt;p&gt;Please open a new terminal window (and keep the first one with STH running). Then issue the following commands in the root directory of this repository&lt;/p&gt;

&lt;p&gt;a) pack directory &lt;code&gt;hello-snowman&lt;/code&gt; into archive &lt;code&gt;hello-sequence.tar.gz&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;si pack ./samples/hello-snowman/ &lt;span class="nt"&gt;-o&lt;/span&gt; ./samples/hello-snowman.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is no output shown in the terminal but you can verify with &lt;code&gt;ls&lt;/code&gt; that the tarball package is created inside the &lt;code&gt;samples&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;b) send hello-snowman.tar.gz to the running host (default localhost API endpoint will be used by the CLI send command)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;si sequence send ./samples/hello-snowman.tar.gz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the output will look similar to this one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Request ok: http://127.0.0.1:8000/api/v1/sequence status: 202 Accepted
SequenceClient &lt;span class="o"&gt;{&lt;/span&gt;
  _id: &lt;span class="s1"&gt;'cf775cc1-105b-473d-b929-6885a0c2182c'&lt;/span&gt;,
  host: HostClient &lt;span class="o"&gt;{&lt;/span&gt;
    apiBase: &lt;span class="s1"&gt;'http://127.0.0.1:8000/api/v1'&lt;/span&gt;,
    client: ClientUtils &lt;span class="o"&gt;{&lt;/span&gt;
      apiBase: &lt;span class="s1"&gt;'http://127.0.0.1:8000/api/v1'&lt;/span&gt;,
      log: &lt;span class="o"&gt;[&lt;/span&gt;Object]
    &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;,
  sequenceURL: &lt;span class="s1"&gt;'sequence/cf775cc1-105b-473d-b929-6885a0c2182c'&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we have uploaded sequence to the host and host assigned to it a random ID (GUID), in my case our sequence ID is:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;_id: 'cf775cc1-105b-473d-b929-6885a0c2182c'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The Host also exposes REST API endpoint for each sequence and this is also described in this response.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;4.3 Run the sequence&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;We can now use sequence ID to run this uploaded sequence. The command is &lt;code&gt;si seq start &amp;lt;sequence_id&amp;gt;&lt;/code&gt;. You can also pass an arbitrary number of parameters by providing them after , in case of our &lt;code&gt;hello-snowman&lt;/code&gt; parameters are not used.&lt;br&gt;
For example for the above sequence we could write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;si sequence start cf775cc1-105b-473d-b929-6885a0c2182c
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the output would look similar to this one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Request ok: http://127.0.0.1:8000/api/v1/sequence/cf775cc1-105b-473d-b929-6885a0c2182c/start status: 200 OK
InstanceClient &lt;span class="o"&gt;{&lt;/span&gt;
  host: HostClient &lt;span class="o"&gt;{&lt;/span&gt;
    apiBase: &lt;span class="s1"&gt;'http://127.0.0.1:8000/api/v1'&lt;/span&gt;,
    client: ClientUtils &lt;span class="o"&gt;{&lt;/span&gt;
      apiBase: &lt;span class="s1"&gt;'http://127.0.0.1:8000/api/v1'&lt;/span&gt;,
      log: &lt;span class="o"&gt;[&lt;/span&gt;Object]
    &lt;span class="o"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;}&lt;/span&gt;,
  _id: &lt;span class="s1"&gt;'e70222d1-acfc-4e00-b046-4a3a9481c53b'&lt;/span&gt;,
  instanceURL: &lt;span class="s1"&gt;'instance/e70222d1-acfc-4e00-b046-4a3a9481c53b'&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A sequence is an app template. Once run, it will become live as a new instance. The instance also receives its own ID (GUID). In this case, instance Id is:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;_id: 'e70222d1-acfc-4e00-b046-4a3a9481c53b'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Of course, sequences can be run multiple times. Each run will create a separate instance with a distinct instance id.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;4.4 Send data to the sequence&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;We want to make your life easier and for this very example, we have prepared a special Node.js app that will generate a stream of simple messages and send them to our running instance of &lt;code&gt;hello-snowman&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;For fun, our stream generator will send simple text messages containing temperature readings from an artificial weather station. Temperature values will be generated randomly in the range of &amp;lt;-50,50&amp;gt; degrees Celsius.&lt;br&gt;
Our &lt;code&gt;hello-snowman&lt;/code&gt; app will read and interpret these messages and will inform us about the state of our Snowman:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;if the temperature will be 0 or below, the sequence will return the message &lt;code&gt;Snowman is freezing ... :)&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;in the other case (temperature above 0 degrees), the sequence will return the message &lt;code&gt;Snowman is melting! :(&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To run this app, please execute this command from the root of our directory &lt;code&gt;node ./tools/stream-gen-tool/stream-gen.js &amp;lt;instance_id&amp;gt;&lt;/code&gt;. In our case this would look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="go"&gt;node ./tools/stream-gen-tool/stream-gen.js e70222d1-acfc-4e00-b046-4a3a9481c53b
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the output would look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nt"&gt;----------------------------------------&lt;/span&gt;
Message# 1 | Temperature measure
INPUT | 41
OUTPUT| Snowman is melting! :&lt;span class="o"&gt;(&lt;/span&gt;
&lt;span class="nt"&gt;----------------------------------------&lt;/span&gt;
Message# 2 | Temperature measure
INPUT | &lt;span class="nt"&gt;-33&lt;/span&gt;
OUTPUT| Snowman is freezing ... :&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nt"&gt;---------------------------------------------&lt;/span&gt;
Message# 3 | Temperature measure
INPUT | &lt;span class="nt"&gt;-36&lt;/span&gt;
OUTPUT| Snowman is freezing ... :&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nt"&gt;---------------------------------------------&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Our sequence generator app does two things here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sends stream of messages; each one containing a number with temperature value&lt;/li&gt;
&lt;li&gt;Reads output from Host API that is generated by our &lt;code&gt;hello-snowman&lt;/code&gt; sequences&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Separately, you can also open a new terminal window and see a log of this particular instance with command &lt;code&gt;si instance log &amp;lt;instance_id&amp;gt;&lt;/code&gt;. In our case, this would be&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;si instance log e70222d1-acfc-4e00-b046-4a3a9481c53b
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the sample output will be similar to this one&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;&lt;span class="c"&gt;...
&lt;/span&gt;&lt;span class="gp"&gt;2021-08-09T04:29:39.790Z log (object:Runner) Input message &amp;lt;Buffer 32 30&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="gp"&gt;2021-08-09T04:29:40.791Z log (object:Runner) Input message &amp;lt;Buffer 2d 34&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="gp"&gt;2021-08-09T04:29:41.792Z log (object:Runner) Input message &amp;lt;Buffer 33 33&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="gp"&gt;2021-08-09T04:29:42.798Z log (object:Runner) Input message &amp;lt;Buffer 2d 34 35&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="gp"&gt;2021-08-09T04:29:43.801Z log (object:Runner) Input message &amp;lt;Buffer 2d 33 36&amp;gt;&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="c"&gt;...
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;blockquote&gt;
&lt;p&gt;Well done! You have run your first Scramjet Transform Hub sequence!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;5 Where to go next&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Here you can find more resources related to Scramjet Transform Hub:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.tosamples"&gt;Check out more samples&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.totemplates"&gt;Start from our app templates&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/scramjetorg/transform-hub"&gt;Contribute to STH development&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://scramjet.org"&gt;Visit our Scramjet.org page&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




</description>
      <category>bigdata</category>
      <category>javascript</category>
      <category>typescript</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Introduction to Scramjet Data Processing Platform</title>
      <dc:creator>Łukasz Kamieniecki-Mruk</dc:creator>
      <pubDate>Thu, 28 Oct 2021 15:35:50 +0000</pubDate>
      <link>https://forem.com/scramjetorg/introduction-to-scramjet-data-processing-platform-5bof</link>
      <guid>https://forem.com/scramjetorg/introduction-to-scramjet-data-processing-platform-5bof</guid>
      <description>&lt;h2&gt;
  
  
  New engine for serverless data processing applications
&lt;/h2&gt;

&lt;p&gt;Our Scramjet data apps engine has its approach to deploying and running serverless applications; in several aspects different from solutions in areas such as software buses, integration platforms, and FaaS offerings. This article explains our approach. We hope you might find it interesting.&lt;/p&gt;

&lt;h2&gt;
  
  
  “3 in 1” data processing platform
&lt;/h2&gt;

&lt;p&gt;The heart of our solution and its data engine is called “Scramjet Transform Hub”. It’s available as a standalone software package on GitHub and will be the core element of our Scramjet Cloud Platform.&lt;/p&gt;

&lt;p&gt;We name our approach “3 in 1 data processing platform” as it combines 3 concepts into one solution:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;data processing engine&lt;/li&gt;
&lt;li&gt;serverless data applications&lt;/li&gt;
&lt;li&gt;complete API with dedicated CLI (covering both I/O and management endpoints)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--W5xw32Gc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b5e3ej4sd1hinbmqlihz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--W5xw32Gc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b5e3ej4sd1hinbmqlihz.png" alt="Scramjet “3 in 1” data processing platform" width="880" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s look at each point separately.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data processing engine
&lt;/h2&gt;

&lt;p&gt;Scramjet Transform Hub creates unified deployment, runtime, management, and execution plan for serverless applications (sequences).&lt;/p&gt;

&lt;p&gt;In short, STH allows you to start data processing in 3 simple steps:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Deploy&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;si sequence send &amp;lt;sequence-package-tar&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Run&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;si sequence run &amp;lt;sequence-id&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Send data&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-H&lt;/span&gt; “Content-Type: application/octet-stream” — data-binary “@file.txt” &amp;lt;instance-input-endpoint&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You are free to post to our sequence simple HTTP requests, file, send a stream or even read data from another stream or API.&lt;br&gt;
Please notice that, contrary to typical microservices architectures, there is no expensive step of building containerized image, pushing it to the registry, and then downloading it to the container orchestrator to run the microservice. You can move from directory with code to sequence processing your data in less than a minute.&lt;/p&gt;

&lt;p&gt;We do package our apps but their size is measured in kilobytes, not in hundreds of megabytes as in the case of container images. Minimal app design gives better performance, optimized resources usage, and a simpler CI/CD process.&lt;/p&gt;

&lt;p&gt;We have prepared a short, 3-minute demo, showing the whole application (sequence) preparation, deployment, and run process on our YouTube channel. Check it below:&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/020MLhJsdG4"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Serverless data applications
&lt;/h2&gt;

&lt;p&gt;We call the user applications sequences. They have capabilities to perform continuous data and stream processing, they have no run time limits or input data size limits.&lt;/p&gt;

&lt;p&gt;Each sequence has a straightforward structure — it’s a directory with at least two core files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;package.json&lt;/strong&gt; — simple JSON file describing sequence metadata&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;index.[js/ts]&lt;/strong&gt; — JavaScript or TypeScript file with sequence code. You are free to structure your app in multiple files if you like.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Below there is the content of one of our sample “hello world” sequences, yielding integer numbers.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;DataStream&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="err"&gt;“&lt;/span&gt;&lt;span class="nx"&gt;scramjet&lt;/span&gt;&lt;span class="err"&gt;”&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="err"&gt;​&lt;/span&gt;
&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;stream&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;end&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;DataStream&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="nx"&gt;start&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
 &lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;end&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;setTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
 &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;};&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;
 &lt;span class="p"&gt;})&lt;/span&gt;
 &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;do&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
 &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;run&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can find intro readme and more samples in our dedicated repository &lt;a href="https://github.com/scramjetorg/scramjet-cloud-docs"&gt;scramjetorg/scramjet-cloud-docs&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  API &amp;amp; CLI
&lt;/h2&gt;

&lt;p&gt;Let’s look at Transform Hub API via commands available in our CLI:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;pack [options] — package directory with sequence code into tar.gz file&lt;/li&gt;
&lt;li&gt;host [command] — monitor and check the version of the host&lt;/li&gt;
&lt;li&gt;config|c [command] — display and manage config&lt;/li&gt;
&lt;li&gt;sequence|seq [command] — pack, deploy, manage and monitor sequences (app templates)&lt;/li&gt;
&lt;li&gt;instance|inst [command] — manage and monitor instances (running apps)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The above commands (and related API) cover complete management of the data processing engine and serverless apps running on top of it.&lt;br&gt;
Once started, each running instance exposes the following API endpoints:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;input, output&lt;/li&gt;
&lt;li&gt;stdin, stdout, stderr&lt;/li&gt;
&lt;li&gt;log, monitoring&lt;/li&gt;
&lt;li&gt;_event (to instance), event (from instance)&lt;/li&gt;
&lt;li&gt;stop, kill&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach follows the “batteries included” approach, and each running instance is handled in the same way.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why our Scramjet Cloud Platform
&lt;/h2&gt;

&lt;p&gt;Our approach shown above has several benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Freedom and flexibility — no artificial limits on data size and execution time of apps; no “execution time limit” or “payload size limit”.&lt;/li&gt;
&lt;li&gt;Great price for value-effective data workflows with fully programmable data acquisition, ability to create patterns between instances performing various data processing tasks.&lt;/li&gt;
&lt;li&gt;Performance by design — instantaneous execution of data without proxies, queues, and gateways. Light apps with minimal resources consumption.&lt;/li&gt;
&lt;li&gt;Works cross-native (Edge &amp;amp; Cloud) — out of the box spanning between locations. Run the same type of apps on edge or smart devices via standalone Scramjet Transform Hub and in our Scramjet Cloud Platform.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As a summary, below you will find a diagram showing various patterns of chaining data processing on our platform:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IKbmcm4l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9aezt5ciq23jx9o3ktzu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IKbmcm4l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9aezt5ciq23jx9o3ktzu.png" alt="Scramjet Transform Hub data flows" width="880" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>typescript</category>
      <category>bigdata</category>
      <category>serverless</category>
    </item>
  </channel>
</rss>
