kinesis

command
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2017 License: MIT Imports: 5 Imported by: 0

README

Kinesis Example

The example program receives a Kinesis event with an array of records and forwards the message from each record to a RequestBin endpoint.

Setup

Run the program locally:

go run main.go < event.json

View the the message in the RequestBin bucket:

request_bin
Base64 Encoding

The record data on the Kinesis stream is Base64 encoded. Therefore in order to emulate a live message from Kinesis we'll manually encode the JSON payload.

Example JSON payload:

{"message": "Hello from Apex!"}

After Base64 encoding:

eyJtZXNzYWdlIjogIkhlbGxvIGZyb20gQXBleCEifQ==

The encoded data withing the event.json payload:

{
  "event": {
    "Records": [
      {
        "eventID": "shardId-000000000000:49545115243490985018280067714973144582180062593244200961",
        "eventVersion": "1.0",
        "Kinesis": {
          "partitionKey": "partitionKey-3",
          "data": "eyJtZXNzYWdlIjogIkhlbGxvIGZyb20gQXBleCEifQ==",   // Base64 encoded data
          "kinesisSchemaVersion": "1.0",
          "sequenceNumber": "49545115243490985018280067714973144582180062593244200961"
        },
        "invokeIdentityArn": "arn:aws:iam::EXAMPLE",
        "eventName": "aws:kinesis:record",
        "eventSourceARN": "arn:aws:kinesis:EXAMPLE",
        "eventSource": "aws:kinesis",
        "awsRegion": "us-east-1"
      }
    ]
  }
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL