The C2K Messaging Service is a micro-service associated to the C2K Project. This particular micro-service is responsible for publishing messages from other C2K or standalone applications into a Spark room.
The C2K program is an attempt to highlight the cpabilities of the Cisco 829 Industrial Integrated Services Routers with integrations into the Cisco Collaboration portfolio as an alternatives to AVLS GPS vehicle tracking systems.
This solution will initially attempt to monitor and report the movement and activity of school buses along with various other real-time use-cases in future releases.
This repository and README provide overall details on the C2K Messaging Service and steps to deploy
The following repositories are where the actual code for the different involved micro-services/components are located.
- c2k_demo - Full Demo Application Setup and Details
- c2k_iox - Details on the Cisco IOx Client Application
- c2k_listener - Details on the C2K payload listener
This is the main listening service responsible for brokering the transaction between the users application (e.g. C2K Listener) and the Spark cloud.
This application does the following:
- Listens for and validates all inbound requests against a REDIS key-value store
- First-time inbound requests create a Spark room with application owner's email address
- Subsequent inbound requests publish messages to the room created for First-time inbound request
To use this application effectively, you will need the following
-
An active Cisco Spark account and BOT token
-
Redis store - consider using RedisLabs Cloud Service
-
A Mantl or marathon stack
This release of the application requires manually creating a Redis Hash store for example
Key: app-01-k0NiHzhql6
Field | Value |
---|---|
sparkagentemail | [email protected] |
The following fields will be auto created by the application
Field | Value |
---|---|
sparkroomid | Spark room id obtained by application e.g. YIDHIHDSFJH/... |
sparkroomwebhook | Spark room webhook created by application e.g. UI8IQEKJH/... (used in future release) |
Send the following JSON format to the application to publish your message to Cisco Spark
{
"appKey" : ”app-01-k0NiHzhql6",
"message" : "Your message to a Spark room"
}
This application can be installed locally on your server, or by using Docker (preferred). In either mode the following environment variables must be present
-
APP_URL=http://the.deployment.url
-
LISTEN_HTTPS\_PORT=the HTTPS listening port
-
LISTEN_HTTP\_PORT=the HTTP listening port
-
REDIS_CONNECTION=redis://the-redis-provider-url:port
-
SPARK_BOT\_TOKEN=Your Spark BOT token
The latest version of this application is available on Docker hub. Start it by using the following command:
docker run -it \
-e APP_URL=http://the.deployment.url \
-e LISTEN_HTTPS\_PORT=the HTTPS listening port \
-e LISTEN_HTTP\_PORT=the HTTP listening port \
-e REDIS_CONNECTION=redis://the-redis-provider-url:port \
-e SPARK_BOT\_TOKEN=Your Spark BOT token \
-p 8080:8080 imapex/c2k_msg`
- Clone this repo
git clone https://github.com/imapex/c2k_msg
- Make sure you have node.js setup
cd c2k_msg
- Install dependencies in package.json
npm install
- Start the app
node broker.js
Alternatively, installation scripts are provided for deploying to a Marathon infrastructure
bash app_install.sh