Horizon SDR To IBM Event Streams Service
This example illustrates a more realistic Horizon edge service by including additional aspects of typical edge services.
Preconditions for Using the SDR To IBM Event Streams Example Edge Service
If you haven't done so already, you must do these steps before proceeding with the sdr2evtstreams example:
-
Install the Horizon management infrastructure (exchange and agbot).
-
Install the Horizon agent on your edge device and configure it to point to your Horizon exchange.
-
Set your exchange org:
export HZN_ORG_ID=<your-cluster-name>
- Create a cloud API key that is associated with your Horizon instance, set your exchange user credentials, and verify them:
export HZN_EXCHANGE_USER_AUTH=iamapikey:<your-API-key>
hzn exchange user list
- Choose an ID and token for your edge node, create it, and verify it:
export HZN_EXCHANGE_NODE_AUTH=<choose-any-node-id>:<choose-any-node-token>
hzn exchange node create -n $HZN_EXCHANGE_NODE_AUTH
hzn exchange node confirm
- Deploy (or get access to) an instance of IBM Event Streams that the sdr2evtstreams sample can send its data to. Ensure that the topic
sdr-audio
is created in Event Streams. Using information from the Event Streams UI, export
these environment variables:
EVTSTREAMS_API_KEY
EVTSTREAMS_BROKER_URL
Using the SDR To IBM Event Streams Edge Service with Deployment Pattern
- Get the user input file for the sdr2evtstreams sample:
wget https://github.com/open-horizon/examples/raw/master/edge/evtstreams/sdr2evtstreams/horizon/userinput.json
- Register your edge node with Horizon to use the sdr2evtstreams pattern:
hzn register -p IBM/pattern-ibm.sdr2evtstreams -f userinput.json
- The edge device will make an agreement with one of the Horizon agreement bots (this typically takes about 15 seconds). Repeatedly query the agreements of this device until the
agreement_finalized_time
and agreement_execution_start_time
fields are filled in:
hzn agreement list
- Once the agreement is made, list the docker container edge service that has been started as a result:
sudo docker ps
- On any machine, install
kafkacat
, then subscribe to the Event Streams topic to see the json data that sdr2evtstreams is sending:
kafkacat -C -q -o end -f "%t/%p/%o/%k: %s\n" -b $EVTSTREAMS_BROKER_URL -X api.version.request=true -X security.protocol=sasl_ssl -X sasl.mechanisms=PLAIN -X sasl.username=token -X sasl.password=$EVTSTREAMS_API_KEY -X -t $EVTSTREAMS_TOPIC
- See the sdr2evtstreams service output:
hzn service log -f ibm.sdr2evtstreams
- Unregister your edge node, stopping the sdr2evtstreams service:
hzn unregister -f