Skip to content

Commit 3afb7a0

Browse files
authored
Merge pull request #281 from segmentio/repo-sync
repo sync
2 parents fbe9e7d + c4b85d2 commit 3afb7a0

File tree

1 file changed

+7
-9
lines changed
  • src/connections/destinations/catalog/amazon-kinesis

1 file changed

+7
-9
lines changed

src/connections/destinations/catalog/amazon-kinesis/index.md

+7-9
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,15 @@ Let's say you're connecting your Segment customer data stream to Kinesis Stream
9393

9494
The Segment Kinesis destination issues a `PutRecord` request with the following parameters:
9595
```js
96-
kinesis.putRecord({
97-
Data: new Buffer(JSON.stringify(msg)).toString('base64')
98-
PartitionKey: msg.userId() || msg.anonymousId(),
99-
StreamName: 'stream-name'
100-
});
96+
const payload = {
97+
Data: JSON.stringify(msg.json()),
98+
StreamName: this.settings.stream,
99+
PartitionKey: this.settings.useMessageId ? msg.field('messageId') : msg.userId() || msg.anonymousId()
100+
}
101+
const request = kinesis.putRecord(payload)
101102
```
102103

103-
Segment uses the the `userId || anonymousId` as the `PartitionKey`. The partition key is used by Amazon Kinesis to distribute data across shards. Amazon Kinesis segregates the data records that belong to a stream into multiple shards, using the partition key associated with each data record to determine which shard a given data record belongs to.
104-
105-
> note ""
106-
> **NOTE:** The JSON payload is base64 stringified.
104+
Segment uses the `messageId` or the `userId || anonymousId` as the `PartitionKey`. The partition key is used by Amazon Kinesis to distribute data across shards. Amazon Kinesis segregates the data records that belong to a stream into multiple shards, using the partition key associated with each data record to determine which shard a given data record belongs to.
107105

108106
## Group
109107
If you're not familiar with the Segment Specs, take a look to understand what the [Group method](/docs/connections/spec/group/) does.

0 commit comments

Comments
 (0)