Skip to content

Commit 7ba2c67

Browse files
authored
Update sailor version to 2.6.26 (#79)
Updated Sailor to 2.6.26
1 parent 26b3c1a commit 7ba2c67

File tree

7 files changed

+280
-16
lines changed

7 files changed

+280
-16
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.4.0 (November 26, 2021)
2+
* Update `Re-assembled message` action: Make Message ID optional
3+
* Update sailor version to 2.6.26
4+
15
## 1.3.0 (October 1, 2021)
26
* Update `Re-assembled message` action: Implemented option to select processing behavior of incoming messages.
37

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ The splitting expression is "users", action will return output:
4545

4646
### Split on JSONata Expression
4747

48-
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.
48+
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.
4949

5050
For example, given the following message:
5151

@@ -98,7 +98,7 @@ Inverse of the split action: Given a stream of incoming messages a sum message i
9898
#### List of Expected Config fields
9999
```Behavior``` - Has 3 different behaviour variants(options):
100100
* 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.
101-
* 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.
101+
* 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.
102102
* 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.
103103

104104
Supported:
@@ -120,7 +120,9 @@ If all the messages in the group do not arrive, then the group will not be emitt
120120
```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.
121121

122122
```messageId``` - Id for a message to distinguish it from other messages in the group.
123-
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.
123+
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.
124+
In case a messageId occures multiple times, only the messageData of the latest message survives.
125+
If the messageId is not defined, a random guid will be generated and used as messageID.
124126

125127
```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.
126128

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"title": "Splitter",
3-
"version": "1.3.0",
3+
"version": "1.4.0",
44
"description": "Splits a message into multiple messages.",
55
"buildType":"docker",
66
"actions": {

lib/actions/reassemble.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// eslint-disable-next-line
22
const { messages } = require('elasticio-node');
3+
const { v4: uuidv4 } = require('uuid');
34
const ObjectStorageWrapperExtended = require('./utils-wrapper/ObjectStorageWrapperExtended');
45

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

1920
// eslint-disable-next-line no-await-in-loop
2021
await this_.emit('data', messages.newMessageWithBody({
21-
groupSize: results.messages.length,
22+
groupSize: Object.keys(results.messageIdsSeen).length,
2223
groupId: results.messages[0].groupId,
2324
messageData: incomingData,
2425
}));
2526
// eslint-disable-next-line no-await-in-loop
2627
await storage.deleteObjectById(groupList[i]);
2728
}
29+
groupList = [];
2830
}
2931

3032
async function processAction(msg, cfg) {
@@ -33,7 +35,7 @@ async function processAction(msg, cfg) {
3335
const {
3436
groupSize,
3537
groupId,
36-
messageId,
38+
messageId = uuidv4(),
3739
messageData,
3840
} = msg.body;
3941
const incomingData = {};
@@ -157,14 +159,14 @@ async function getMetaModel(cfg) {
157159
},
158160
messageId: {
159161
type: 'string',
160-
required: true,
162+
required: false,
161163
title: 'Unique ID to describe this message',
162164
order: 4,
163165
},
164166
groupSize: {
165167
type: 'number',
166168
required: true,
167-
title: 'Number of messages produced by splitter',
169+
title: 'Number of messages expected to be reassembled into the group',
168170
order: 3,
169171
},
170172
messageData: {
@@ -195,7 +197,7 @@ async function getMetaModel(cfg) {
195197
},
196198
messageId: {
197199
type: 'string',
198-
required: true,
200+
required: false,
199201
title: 'Unique ID to describe this message',
200202
order: 4,
201203
},
@@ -236,13 +238,13 @@ async function getMetaModel(cfg) {
236238
},
237239
messageId: {
238240
type: 'string',
239-
required: true,
241+
required: false,
240242
title: 'Unique ID to describe this message',
241243
order: 4,
242244
},
243245
groupSize: {
244246
type: 'number',
245-
title: 'Number of messages produced by splitter',
247+
title: 'Number of messages expected to be reassembled into the group',
246248
order: 3,
247249
},
248250
timersec: {

package-lock.json

Lines changed: 15 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
"@elastic.io/component-commons-library": "1.1.4",
1919
"@elastic.io/maester-client": "3.3.0",
2020
"elasticio-node": "0.0.9",
21-
"elasticio-sailor-nodejs": "2.6.24",
22-
"lodash": "4.17.19"
21+
"elasticio-sailor-nodejs": "2.6.26",
22+
"lodash": "4.17.19",
23+
"uuid": "8.3.2"
2324
},
2425
"devDependencies": {
2526
"@elastic.io/component-logger": "0.0.1",

0 commit comments

Comments
 (0)