node-scheduled-stream-lambda
Scheduled stream lambda class for constructing data apps that run on schedule and handle streams.
ToC
Requirements
- node.js - >=12.0.0
Getting started
Installation
npm i @corva/node-scheduled-stream-lambda
Features
- Defines scheduled stream workflow
Examples
const { ScheduledStreamLambda } = require('@corva/node-scheduled-stream-lambda');
// you may need api client and other libs
const { ApiClient } = require('@corva/node-api-client');
const apiClient = new ApiClient();
const lambda = new ScheduledStreamLambda({
apiClient,
process: async ({ event, context }) => {
const result = event.a + event.b;
return result;
},
});
Scheduled stream event
Scheduled stream event could look like this:
const event = [
[
{
type: 'data_app',
collection: 'activity-groups',
cron_string: '*/5 * * * *',
environment: 'qa',
app: 1,
app_key: 'corva.activity-group',
app_version: '0.0.1',
app_connection: 12345,
source_type: 'drilling',
company: 1,
provider: 'corva',
api_url: 'https://some-url',
api_key: 'activity-group-key',
schedule: 116027101,
interval: 300,
schedule_start: 1575970800000,
schedule_end: 1575971100000,
asset_id: 1,
asset_name: 'My Asset',
asset_type: 'Well',
timezone: 'America/Chicago',
},
{
type: 'data_app',
collection: 'activity-groups',
cron_string: '*/5 * * * *',
environment: 'qa',
app: 1,
app_key: 'corva.activity-group',
app_version: '0.0.1',
app_connection: 12345,
source_type: 'drilling',
company: 1,
provider: 'corva',
api_url: 'https://some-url',
api_key: 'activity-group-key',
schedule: 116027102,
interval: 300,
schedule_start: 1575971100000,
schedule_end: 1575971400000,
asset_id: 1,
asset_name: 'My Asset',
asset_type: 'Well',
timezone: 'America/Chicago',
}
]
];