Create the Cloudant Database
- This tutorial assumes the availability of a Cloudant database. You can use IBM Bluemix to provide this (free of charge). Sign into IBM Bluemix, find the Cloudant NoSQL DB in the Data & Analytics section of the IBM Bluemix Catalog, and create an instance.
- Navigate to the Service Credentials section and you will find connection details that we will be using to tell IIB how to communicate with your Bluemix Cloudant instance. They should look similar to this:
{
"username": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa-bluemix",
"password": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"host": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa-bluemix.cloudant.com",
"port": 443,
"url": "https://aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa-bluemix:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb@aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa-bluemix.cloudant.com"
} - Create a database called
share_price
.
Configure the IIB LoopBack connector
- To use the LoopBackRequest node in this tutorial, you must install the Cloudant LoopBack connector. Open the IBM Integration Bus Command Console:
cd %MQSI_WORKPATH%\node_modules
npm install loopback-connector-cloudant
- If you don't already have one, create a datasources.json file in the connectors/loopback folder of your IIB workpath (by default on Windows, this will be at C:\ProgramData\IBM\MQSI\connectors\loopback). This is where IIB stores connection information for Loopback Request node instances.
- Add a stanza to the datasources.json file:
{ "CLOUDANT":{"database": "share_price","name": "CLOUDANT","host": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa-bluemix.cloudant.com","port": 443,"connector": "cloudant"}}
- From your command console configure IIB with your Cloudant security credentials like this:
mqsisetdbparms TESTNODE_userid -n loopback::CLOUDANT_SEC_ID -u aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa-bluemix -p bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
- Restart your node.