Release v1.22.0

New DynamoDB format option, editable rules, and destination testing.

B
Written by Ben Mills
Updated over a week ago

This document outlines the changes to the BitBrew platform and management API that will be released Aug 5, 2019. Changes should be carefully read and understood.

Table of Contents

  • New formatting option for data delivered to Amazon DynamoDB

  • Rules are now editable

  • Destination testing

New Formatting Option for Data Delivered to AWS DynamoDB

Overview

When creating or editing a DynamoDB destination, users now have two options for formatting the way data will be written to the Dynamo table: 

  • Document 

  • Columns 

The first option preserves current formatting, which has a number of static columns, including a column called message  which contains all of the event information.

The second option 'flattens' the event being written to the database, so that every key in the JSON of the event is a column. Column names reflect the nesting of the event with concatenated, period-delimited keys.

API Calls

POST /v1/tenants/{tenantId}destinations/dynamodb
Request Body

{
  "name”: “bitbrew-demo",
  "awsClientId”: “ALBQTAJ3VZIGZFWVA ",
  "awsClientSecret”: “4YrGdIZ9WIa1ndVvIMw1fKDBf9H34atqvZ0LbA6VVm ",
  "awsRegion": "us-east-2",
  "tableName": "VinsByDeviceId",
  "format": "Columns"
}

Response 200 

{
  "id": "3fa6450a-3379-407c-a765-79297cd521e5",
  "type": "dynamodb",
  "name": "bitbrew-demo",
  "messagesPendingDelivery": 0,
  "awsClientId": "ALBQTAJ3VZIGZFWVA ",
  "awsRegion": "us-east-2",
  "tableName": "VinsByDeviceId",
  "format": "Columns"
}

See more on our API documentation.

What Does It Mean?

Because of the way BitBrew previously wrote data into DynamoDB, users could not create secondary indexes on attributes in their event data because it was nested in a JSON document. With the new column option, every key in the event body or header is an option for indexing.

Rules Are Now Editable

You can now edit an existing rule with the following method:
PUT v1/tenants/{tenantId}/rules/{ruleName}
Request Body

{
  "enabled": false,
  "text": "rule <ruleId> using my_Map= {body = body } where true with amqp(json(bindings.my_Map))"
}


Response 200

{    
  "createdAt": "2019-03-27T19:07:30.315Z",
  "enabled": false,
  "name": "AllEvents",
  "text": "rule AllEvents\nusing my_Map = {\n  body = body\n}\nwhere true\nwith amqp(json(bindings.my_Map))"
}

Editing the rule text will result in a straight replace of the former text with the submitted text.

Destination Testing

If you want to test that a destination is set up properly, you can now send a test event directly to a destination through the platform's management API.

Testing a Queue

To send a test event to a queue, use the method below. The queue name is required, but the payload is optional. If you do not include the payload  key, a default payload will be provided.

POST v1/tenants/{tenantId}/test/destination/amqp 

Request Body

{
  "queue": "GpsEvents",
}

Response 200

{
  "queue": "GpsEvents",
  "payload": {
    "timestamp": "2019-08-06T13:40:18.761Z",
    "type": "bbTestMessage"
  }
}

If you were to consume the message that appeared in the queue, it would match the value of the payload  exactly:

{
  "timestamp": "2019-08-06T13:40:18.761Z",
  "type": "bbTestMessage"
}

Testing a DynamoDB Table

To send a test event to a DynamoDB table, use the method below. The destination ID is required, but the payload is optional. If you do not include the payload  key, a default payload will be provided.

POST v1/tenants/{tenantId}/test/destination/dynamodb
Request Body

{
"destinationId": "cf78f959-e5da-4fc9-8cc3-aa948866a7f6",
}

Response 200

{
  "destinationId": "cf78f959-e5da-4fc9-8cc3-aa948866a7f6",
  "deviceId": "0000000000",
  "eventId": "df78f959-e5da-4fc9-8cc3-aa948866a7f6",
  "payload": {
    "timestamp": "2019-08-06T13:40:18.761Z",
    "type": "bbTestMessage"
  }
}

Testing a Google Bigtable

To send a test event to a DynamoDB table, use the method below. The destination ID is required, but the payload is optional. If you do not include the payload  key, a default payload will be provided.

POST v1/tenants/{tenantId}/test/destination/bigtable

 
Request Body

{
"destinationId": "46fb5ec1-b82a-4bea-952b-48f5c7292901",
}

Response 200

{
  "destinationId": "46fb5ec1-b82a-4bea-952b-48f5c7292901",
  "deviceId": "0000000000",
  "eventId": "cf78f959-e5da-4fc9-8cc3-aa948866a7f6",
  "payload": {
    "timestamp": "2019-08-06T13:40:18.761Z",
    "type": "bbTestMessage"
  }
}

Testing a Webhook

To send a test event to a webhook table, use the method below. The uri is required, but the payload is optional. If you do not include the payload  key, a default payload will be provided.

POST v1/tenants/{tenantId}/test/destination/webhook

 
Request Body

{
"uri": "http://request.bin/lksdjf",
}

Response 200

{
  "uri": "http://request.bin/lksdjf",
  "payload": {
    "timestamp": "2019-08-06T13:40:18.761Z",
    "type": "bbTestMessage"
  }
}

Did this answer your question?