# Example Collection

This repository contains a collection of KGrid Knowledge Objects that demonstrate features of the grid, good development practices, and useful tools.

# Anatomy of this Knowledge Object project.

The following structure is not an requirement or enforced, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

# Prerequisites

# Directories

  • collection/ contains one to many directories representing knowledge objects

    • object-name a directory for each knowledge object (e.g. js-simple-v1.0)
  • docs/ is a sub-directory for this information about these KOs

  • performanceTest/ contains performance tests that will send a number of requests to an activator endpoint. You must have K6 installed(opens new window) . Tests can be run from the performanceTest directory with: k6 run -e URL=<Endpoint URL to be tested> k6post.js -u <Amount of users> -i <Amount of iterations>

    example: k6 run -e URL=http://localhost:8080/js/simple/1.0/welcome k6post.js -u 10 -i 1000

  • test-collection/ contains a few objects that contain errors for the purpose of debugging Kgrid components.

# Example Knowledge Objects

# Adapters and running Knowledge Objects

Currently, the KGrid Activator has several adapters that can be used to run knowledge objects:

# Running Example KOs in an Activator

You can now test the example objects in an activator. This is done most easily via the kgrid cli(opens new window) . Download the cli using

npm install -g @kgrid/cli

and run

kgrid setup

to download the required kgrid components and then in the /collection directory run

kgrid start:activator

to start an activator that loads the example collection. You can then browse the collection by going to http://localhost:8080(opens new window)

# Package

You can use the kgrid cli(opens new window) to package the collection of knowledge objects by going into the /collection directory and running

kgrid package-all

This will add a checksum to the deployment spec of each object, which the remote runtimes will optionally use to help with caching.

Last Updated: 11/30/2020, 4:01:47 PM