daas workshop
  • Hands-On experience building a Data as a Service Platform
  • Set Up
    • Creating a Workstation
    • Installing Tools
    • Starting Kafka
    • Congratulations
  • Module I - Overview of the DaaS Pattern
    • Section I - The Overall Pattern
    • Section II - Data Sourcing
    • Section III - Data Provisioning
    • Section IV - Data Consumption
  • Module II - Building a Rust Project
    • Section I - Create a Package
    • Section II - Creating a Library
    • Section III - Creating an Executable
    • Section IV - Creating a Hello World RESTful Endpoint
      • Section IV - manifest
      • Section IV - library
      • Section IV - module
      • Section IV - integrated testing
      • Section IV - executable
  • Module III - Building a RESTful Endpoint for Sourcing Data
    • Section I - Overview
    • Section II - manifest
    • Section III - executable
    • Section IV - starting the service
    • Section V - service testing
  • Module IV - Building a Genesis Microservice for Processing the Sourced Data
    • Section I - Overview
    • Section II - manifest
    • Section III - executable
    • Section IV - starting the service
    • Section V - service testing
  • Module V - Building a Provisioning Microservice
    • Section I - Overview
    • Section II - manifest
    • Section III - executable
    • Section IV - starting the service
    • Section V - adding the business logic
    • Section VI - testing the service
  • Module VI - Building a RESTful Endpoint for Publishing Reporting Data
    • Section I - Overview
    • Section II - manifest
    • Section III - executable
    • Section IV - starting the service
    • Section V - adding the business logic
    • Section VI - testing the service
  • Privacy Design Strategies
  • Further Exploration
Powered by GitBook
On this page
  • Kafka
  • S3 Bucket

Was this helpful?

  1. Module IV - Building a Genesis Microservice for Processing the Sourced Data

Section V - service testing

Since the genesis service is not a RESTful service, we will have to verify that it is successfully running using Kafka consumer and a S3 Bucket lookup.

Kafka

The genesis service dynamically creates topics based on the metadata of the DaaSDocument that is consumes.

Let's see what topics it has created.

NOTE: You will want to run this in a new terminal.

./kafka_2.13-2.6.0/bin/kafka-topics.sh --list --zookeeper localhost:2181

You should see the following topics in the results.

__consumer_offsets
genesis
iStore
order
order.clothing
order.clothing.iStore

The genesis service parsed the parameters in the resource path of the RESTful call and created topics accordingly.

http://localhost:8000/order/clothing/iStore/5000

This feature allows us to create downstream provisioning services based on the data we wish to process. (We'll see this in the next module.)

Let's look at the documents that have been sent to one of these topics.

./kafka_2.13-2.6.0/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic order.clothing --from-beginning

S3 Bucket

Before the genesis service send copies of the DaaSDocument downstream to be provisioned, it first stored the original copy in the S3 bucket that was configured in the gensis.rs file.

// NOTE: Modify the Bucket name to match your bucket
// Credentials are read from the environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
pub const BUCKET_NAME: &'static str = "iapp-archconf-workshop";

To confirm that the DaaSDocument has been stored in the S3 bucket, run the following command.

aws s3api list-objects --bucket iapp-archconf-workshop --prefix genesis --query 'Contents[].{Key: Key, Size: Size}'

A json array should be returned with the file(s) .daas

ArchConfWorkshopUser:~/environment $ aws s3api list-objects --bucket iapp-archconf-workshop --prefix genesis --query 'Contents[].{Key: Key, Size: Size}'                                                                                                                      
[
    {
        "Key": "genesis/order~clothing~iStore~5000.daas", 
        "Size": 706
    }
]

Try to look at the versions

aws s3api list-object-versions --bucket iapp-archconf-workshop --prefix genesis
{
    "Versions": [
        {
            "LastModified": "2020-11-04T22:03:06.000Z", 
            "VersionId": "PMQQBJ6T2ve8qAD45J.ELqMSpNJX6.fW", 
            "ETag": "\"295472db3011b179b342b010fcee20e3\"", 
            "StorageClass": "STANDARD", 
            "Key": "genesis/order~clothing~iStore~5000.daas", 
            "IsLatest": true, 
            "Size": 706
        }, 
        {
            "LastModified": "2020-11-04T21:28:29.000Z", 
            "VersionId": "gbNzGC825DGEgAcfNJgxDOFt702q.jlZ", 
            "ETag": "\"efca02daba2596ea31ed02544eed7f3e\"", 
            "StorageClass": "STANDARD", 
            "Key": "genesis/order~clothing~iStore~5000.daas", 
            "IsLatest": false, 
            "Size": 706
        }, 
        {
            "LastModified": "2020-11-04T21:28:29.000Z", 
            "VersionId": "0jR5YYDmN4REFMskajl.NrerSR3E0iUr", 
            "ETag": "\"714eddb4c1424840d96d319f537cf9a3\"", 
            "StorageClass": "STANDARD", 
            "Key": "genesis/order~clothing~iStore~5000.daas", 
            "IsLatest": false, 
            "Size": 706
        }
    ]
}
PreviousSection IV - starting the serviceNextModule V - Building a Provisioning Microservice

Last updated 4 years ago

Was this helpful?