Skip to content

Commit

Permalink
Update sailor version to 2.6.26 (#79)
Browse files Browse the repository at this point in the history
Updated Sailor to 2.6.26
  • Loading branch information
A3a3e1 authored Nov 26, 2021
1 parent 26b3c1a commit 7ba2c67
Show file tree
Hide file tree
Showing 7 changed files with 280 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.4.0 (November 26, 2021)
* Update `Re-assembled message` action: Make Message ID optional
* Update sailor version to 2.6.26

## 1.3.0 (October 1, 2021)
* Update `Re-assembled message` action: Implemented option to select processing behavior of incoming messages.

Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The splitting expression is "users", action will return output:

### Split on JSONata Expression

This component takes the incoming message body and applies the configured JSONata tranformation on it. The evaluated transformation must be an array. This array is split and emitted into multiple messages.
This component takes the incoming message body and applies the configured JSONata transformation on it. The evaluated transformation must be an array. This array is split and emitted into multiple messages.

For example, given the following message:

Expand Down Expand Up @@ -98,7 +98,7 @@ Inverse of the split action: Given a stream of incoming messages a sum message i
#### List of Expected Config fields
```Behavior``` - Has 3 different behaviour variants(options):
* Produce Groups of Fixed Size (Don't Emit Partial Groups): A message is emitted once the group size is reached for the given group. If arriving messages for a particular group are less than the defined group size then the group will not be emitted.
* Group All Incoming Messages: All incomming messages will be gathered until there are no more incoming messages at which point messages will be emitted for each group.
* Group All Incoming Messages: All incoming messages will be gathered until there are no more incoming messages in the specifeid timeframe (delay timer) at which point messages will be emitted for each group.
* Produce Groups of Fixed Size (Emit Partial Groups): Specify both group size and delay timer. Once a group is complete, that group will be emitted. Once there are no more incoming messages, then partially completed groups will also be emitted.

Supported:
Expand All @@ -120,7 +120,9 @@ If all the messages in the group do not arrive, then the group will not be emitt
```groupId``` - Globally unique id for the group to distinguish it from other groups. This value needs to be the same for all messages in a group.

```messageId``` - Id for a message to distinguish it from other messages in the group.
Must be unique per group but does not have to be globally unique. This value needs to be different for all messages in a group.
Must be unique per group but does not have to be globally unique. This value needs to be different for all messages in a group.
In case a messageId occures multiple times, only the messageData of the latest message survives.
If the messageId is not defined, a random guid will be generated and used as messageID.

```messageData``` - Data from individual messages can be inserted here in form of an object. This object is then inserted into an array which is available in the message emitted for this group.

Expand Down
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "Splitter",
"version": "1.3.0",
"version": "1.4.0",
"description": "Splits a message into multiple messages.",
"buildType":"docker",
"actions": {
Expand Down
16 changes: 9 additions & 7 deletions lib/actions/reassemble.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// eslint-disable-next-line
const { messages } = require('elasticio-node');
const { v4: uuidv4 } = require('uuid');
const ObjectStorageWrapperExtended = require('./utils-wrapper/ObjectStorageWrapperExtended');

let timeHandle;
Expand All @@ -18,13 +19,14 @@ async function timer(this_) {

// eslint-disable-next-line no-await-in-loop
await this_.emit('data', messages.newMessageWithBody({
groupSize: results.messages.length,
groupSize: Object.keys(results.messageIdsSeen).length,
groupId: results.messages[0].groupId,
messageData: incomingData,
}));
// eslint-disable-next-line no-await-in-loop
await storage.deleteObjectById(groupList[i]);
}
groupList = [];
}

async function processAction(msg, cfg) {
Expand All @@ -33,7 +35,7 @@ async function processAction(msg, cfg) {
const {
groupSize,
groupId,
messageId,
messageId = uuidv4(),
messageData,
} = msg.body;
const incomingData = {};
Expand Down Expand Up @@ -157,14 +159,14 @@ async function getMetaModel(cfg) {
},
messageId: {
type: 'string',
required: true,
required: false,
title: 'Unique ID to describe this message',
order: 4,
},
groupSize: {
type: 'number',
required: true,
title: 'Number of messages produced by splitter',
title: 'Number of messages expected to be reassembled into the group',
order: 3,
},
messageData: {
Expand Down Expand Up @@ -195,7 +197,7 @@ async function getMetaModel(cfg) {
},
messageId: {
type: 'string',
required: true,
required: false,
title: 'Unique ID to describe this message',
order: 4,
},
Expand Down Expand Up @@ -236,13 +238,13 @@ async function getMetaModel(cfg) {
},
messageId: {
type: 'string',
required: true,
required: false,
title: 'Unique ID to describe this message',
order: 4,
},
groupSize: {
type: 'number',
title: 'Number of messages produced by splitter',
title: 'Number of messages expected to be reassembled into the group',
order: 3,
},
timersec: {
Expand Down
18 changes: 15 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
"@elastic.io/component-commons-library": "1.1.4",
"@elastic.io/maester-client": "3.3.0",
"elasticio-node": "0.0.9",
"elasticio-sailor-nodejs": "2.6.24",
"lodash": "4.17.19"
"elasticio-sailor-nodejs": "2.6.26",
"lodash": "4.17.19",
"uuid": "8.3.2"
},
"devDependencies": {
"@elastic.io/component-logger": "0.0.1",
Expand Down
Loading

0 comments on commit 7ba2c67

Please sign in to comment.