/sample-java-workWithAWSKinesis

A sample system (including multiple apps) can read ARTIK Cloud device data from AWS Kinesis Stream

Primary LanguageJava

Build a sample system using ARTIK Cloud and Kinesis Stream integration

The sample system has the following functionalities:

  1. Subscribe AWS Kinesis Stream to ARTIK Cloud
  2. Devices send data to ARTIK Cloud
  3. Read device data from Kinesis Stream

We build two applications to achieve Item 1 and 3, and use the Device Simulator instead of real devices to achieve Item 2.

After completing this sample, you will learn the following objectives:

Requirements

Setup / Installation

Setup at ARTIK Cloud

  1. Open My ARTIK Cloud and connect a device (or use one that you already own) of the device type (for example, Demo Fire Sensor with unique name cloud.artik.sample.demofiresensor). You will use the device simulator to send data to ARTIK Cloud on behalf of this device later.
  2. Open the API Console and follow the instruction to get the access token. This access token is your user token. Then get your user ID. Note the user ID and access token. You will need them later.

Setup at Amazon AWS

  1. Sign up for an AWS account if you have not done so.
  2. Get the AWS access key and secret of your AWS user/role. You will need them later.
  3. Create a Kinesis stream with one shard on aws site. For example, you can do it using the AWS Kinesis Console. Noted the stream name (e.g. akcstream) and service region (e.g. us-west-1). You will need them later.

Setup two Java projects

  1. Clone this repository if you haven't already done so.
  2. Build the subscription app. Go to sub-kinesis-stream-to-akc directory and run the following command:
mvn clean package

The executable sub-kinesis-to-akc-x.x.jar is generated under the target directory. Run the following command to learn the usage:

java -jar sub-kinesis-to-akc-x.x.jar -h
  1. Build the Stream reader app. Go to kinesis-stream-consumer directory from the root and run the following command:
mvn clean package

The executable read-stream-x.x.jar is generated under the target directory. Run the following command to learn the usage:

java -jar read-stream-x.x.jar -h

Send data to ARTIK Cloud and read them from Kinesis stream

Read the blog post Build a system to send ARTIK Cloud data to an Amazon Kinesis Stream for the full details!

More about ARTIK Cloud

If you are not familiar with ARTIK Cloud, we have extensive documentation at https://developer.artik.cloud/documentation

The full ARTIK Cloud API specification can be found at https://developer.artik.cloud/documentation/api-spec

Check out advanced sample applications at https://developer.artik.cloud/documentation/samples/

To create and manage your services and devices on ARTIK Cloud, create an account at https://developer.artik.cloud

Also see the ARTIK Cloud blog for tutorials, updates, and more: http://artik.io/blog/cloud

License and Copyright

Licensed under the Apache License. See LICENSE.

Copyright (c) 2017 Samsung Electronics Co., Ltd.