You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A complete, step-by-step recipe can be found in the [Examples](./Examples) folder.
@@ -76,13 +78,13 @@ This class represents an AWS Kinesis Streams record: a combination of data attri
76
78
77
79
This method creates and returns an AWSKinesisStreams.Record object that can be written into an Amazon Kinesis stream using [AWSKinesisStreams.Producer](#awskinesisstreamsproducer-class) methods.
78
80
79
-
| Parameter | Data Type | Required?| Description |
81
+
| Parameter | Data Type | Required | Description |
80
82
| --- | --- | --- | --- |
81
83
|*data*| Blob or [JSON-compatible type](#json-compatible-type)| Yes | The record data |
82
84
|*partitionKey*| String | Yes | Identifies which shard in the stream the data record is assigned to (see the [Kinesis Streams documentation](http://docs.aws.amazon.com/kinesis/latest/APIReference/API_Record.html#Streams-Type-Record-PartitionKey)) |
83
-
|*explicitHashKey*| String |Optional| The hash value used to explicitly determine the shard the data record is assigned to by overriding the partition key hash (see the [Kinesis Streams documentation](http://docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecord.html#Streams-PutRecord-request-ExplicitHashKey)) |
84
-
|*prevSequenceNumber*| String |Optional| See the [Kinesis Streams documentation](http://docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecord.html#Streams-PutRecord-request-SequenceNumberForOrdering)|
85
-
|*encoder*| Function |Optional| A custom JSON encoder function for encoding the provided data (e.g. [JSONEncoder.encode](https://github.com/electricimp/JSONEncoder)) |
85
+
|*explicitHashKey*| String |No| The hash value used to explicitly determine the shard the data record is assigned to by overriding the partition key hash (see the [Kinesis Streams documentation](http://docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecord.html#Streams-PutRecord-request-ExplicitHashKey)) |
86
+
|*prevSequenceNumber*| String |No| See the [Kinesis Streams documentation](http://docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecord.html#Streams-PutRecord-request-SequenceNumberForOrdering)|
87
+
|*encoder*| Function |No| A custom JSON encoder function for encoding the provided data (eg. [*JSONEncoder.encode()*](https://github.com/electricimp/JSONEncoder)) |
86
88
87
89
## AWS_KINESIS_STREAMS_ENCRYPTION_TYPE Enum ##
88
90
@@ -103,7 +105,7 @@ This class allows the agent to write data records to a specific AWS Kinesis stre
103
105
104
106
Creates and returns an AWSKinesisStreams.Producer object. The constructor’s parameters are as follows:
105
107
106
-
| Parameter | Data Type | Required?| Description |
108
+
| Parameter | Data Type | Required | Description |
107
109
| --- | --- | --- | --- |
108
110
|*region*| String | Yes | The Region code of Amazon EC2 (see the [Amazon EC2 documentation](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html).) |
109
111
|*accessKeyId*| String | Yes | The access key ID of an AWS IAM user. See the [Kinesis Streams documentation](http://docs.aws.amazon.com/streams/latest/dev/learning-kinesis-module-one-iam.html)) |
@@ -116,10 +118,10 @@ Creates and returns an AWSKinesisStreams.Producer object. The constructor’s pa
116
118
117
119
This method writes a single data record into the AWS Kinesis stream. For more information, please see the corresponding [Kinesis Streams REST API action](http://docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecord.html).
118
120
119
-
| Parameter | Data Type | Required?| Description |
121
+
| Parameter | Data Type | Required | Description |
120
122
| --- | --- | --- | --- |
121
123
|*record*|[AWSKinesisStreams.Record](#awskinesisstreamsrecord-class)| Yes | The record to be written |
122
-
|*callback*| Function |Optional| Executed once the operation is completed |
124
+
|*callback*| Function |No| Executed once the operation is completed |
123
125
124
126
The method returns nothing. The result of the operation may be obtained via the *callback* function, which has the following parameters:
125
127
@@ -132,10 +134,10 @@ The method returns nothing. The result of the operation may be obtained via the
132
134
133
135
This method writes multiple data records into the AWS Kinesis stream in a single request. Every record is processed by AWS individually. Some of the records may be written successfully but some may fail. For more information, please see the corresponding [Kinesis Streams REST API action](http://docs.aws.amazon.com/kinesis/latest/APIReference/API_PutRecords.html).
134
136
135
-
| Parameter | Data Type | Required?| Description |
137
+
| Parameter | Data Type | Required | Description |
136
138
| --- | --- | --- | --- |
137
139
|*records*| Array of [AWSKinesisStreams.Records](#awskinesisstreamsrecord-class)| Yes | The records to be written |
138
-
|*callback*| Function |Optional| Executed once the operation is completed |
140
+
|*callback*| Function |No| Executed once the operation is completed |
139
141
140
142
The method returns nothing. The result of the operation may be obtained via the *callback* function, which has the following parameters:
141
143
@@ -167,13 +169,13 @@ This class allows your code to read data records from a specific AWS Kinesis Str
167
169
168
170
This method creates and returns an AWSKinesisStreams.Consumer object. The constructor’s parameters are as follows:
169
171
170
-
| Parameter | Data Type | Required?| Description |
172
+
| Parameter | Data Type | Required | Description |
171
173
| --- | --- | --- | --- |
172
174
|*region*| String | Yes | The Region code of Amazon EC2 (see the [EC2 documentation](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html)) |
173
175
|*accessKeyId*| String | Yes | The access key ID of an AWS IAM user (see the [Kinesis Streams documentation](http://docs.aws.amazon.com/streams/latest/dev/learning-kinesis-module-one-iam.html)) |
174
176
|*secretAccessKey*| String | Yes | The secret access key of an AWS IAM user (see the [Kinesis Streams documentation](http://docs.aws.amazon.com/streams/latest/dev/learning-kinesis-module-one-iam.html)) |
175
177
|*streamName*| String | Yes | The name of an AWS Kinesis stream |
176
-
|*isBlob*| Boolean |Optional| If `true`, the AWSKinesisStreams.Consumer object will consider every received data record as a Squirrel blob. If `false` or not specified, the AWSKinesisStreams.Consumer object will consider every received data record as a JSON data and parse it into an appropriate [JSON-compatible type](#json-compatible-type)|
178
+
|*isBlob*| Boolean |No| If `true`, the AWSKinesisStreams.Consumer object will consider every received data record as a Squirrel blob. If `false` or not specified, the AWSKinesisStreams.Consumer object will consider every received data record as a JSON data and parse it into an appropriate [JSON-compatible type](#json-compatible-type)|
177
179
178
180
Before creating an AWSKinesisStreams.Consumer instance your code should know which type of data it is going to receive: binary data (a Squirrel blob) or a [JSON-compatible type](#json-compatible-type). This choice is specified in the AWSKinesisStreams.Consumer constructor and cannot be changed after that. In a complex case, your application can specify the data as a blob and parse it to a specific or custom type by itself.
179
181
@@ -183,7 +185,7 @@ Before creating an AWSKinesisStreams.Consumer instance your code should know whi
183
185
184
186
This method retrieves a list of the IDs of all the shards in the AWS Kinesis stream, including closed shards. Closed shards may still contain records your application may need to read.
185
187
186
-
| Parameter | Data Type | Required?| Description |
188
+
| Parameter | Data Type | Required | Description |
187
189
| --- | --- | --- | --- |
188
190
|*callback*| Function | Yes | Executed once the operation is completed |
189
191
@@ -200,7 +202,7 @@ This method allows your code to specify a start position from which the reading
200
202
201
203
**Note** Every shard iterator returned by *getShardIterator()* or *getRecords()* expires five minutes after it is returned. Your application should call *getRecords()* with the iterator before it expires, otherwise the call will fail and your code will need to obtain a new iterator using *getShardIterator()*.
202
204
203
-
| Parameter | Data Type | Required?| Description |
205
+
| Parameter | Data Type | Required | Description |
204
206
| --- | --- | --- | --- |
205
207
|*shardId*| String | Yes | The shard ID. |
206
208
|*type*|[AWS_KINESIS_STREAMS_SHARD_ITERATOR_TYPE](#aws_kinesis_streams_shard_iterator_type-enum)| Yes | The shard iterator type. Determines how the shard iterator is used to start reading data records from the shard. Some of the types require the corresponding *typeOptions* to be specified |
@@ -223,12 +225,12 @@ The method returns nothing. The result of the operation may be obtained via the
223
225
224
226
This method allows your code to read a portion of data records using the specified shard iterator and returns the next shard iterator which can be used to read the next portion of data records by calling *getRecords()* again. Reading is always going to prefer older records over the latest. For more information, please see the corresponding [Kinesis Streams REST API action](http://docs.aws.amazon.com/kinesis/latest/APIReference/API_GetRecords.html).
225
227
226
-
| Parameter | Data Type | Required?| Description |
228
+
| Parameter | Data Type | Required | Description |
227
229
| --- | --- | --- | --- |
228
230
|*options*| Table | Yes | Options for the operation (see below) |
229
231
|*callback*| Function | Yes | Executed once the operation is completed |
230
232
231
-
|*options* key | Data Type | Required?| Description |
233
+
|*options* key | Data Type | Required | Description |
232
234
| --- | --- | --- | --- |
233
235
|*shardIterator*| String | Yes | The shard iterator that specifies the position in the shard from which the reading should be started |
234
236
|*limit*| Integer | Optional | The maximum number of data records to read. If not specified, the number of returned records is AWS Kinesis Streams specific (see the [Kinesis Streams documentation](http://docs.aws.amazon.com/kinesis/latest/APIReference/API_GetRecords.html#Streams-GetRecords-request-Limit)) |
@@ -276,8 +278,8 @@ A type of Squirrel data which can be encoded/decoded into/from JSON, eg. table,
276
278
#require "AWSKinesisStreams.agent.lib.nut:1.1.0"
277
279
#require "JSONEncoder.class.nut:2.0.0"
278
280
279
-
//This class can be used to hold numbers larger than Squirrel can natively support (i.e. anything larger than 32-bit)
280
-
//and then be encoded as a number (rather than a string) when encoded with `JSONEncoder.encode`.
281
+
//This class can be used to hold numbers larger than Squirrel can natively support (ie. anything larger than 32-bit)
282
+
//and then be encoded as a number (rather than a string) when encoded with 'JSONEncoder.encode()'.
AWSKinesisStreams.Record({ "a" : JSONLiteralString("123456789123456789") }, "partitionKey4", null, null, JSONEncoder.encode.bindenv(JSONEncoder)) //write record using custom encoder
0 commit comments