I'm starting to explore the possibilities of integration between IBM Integration Bus ( and thus IBM AppConnect Enterprise ) and IBM Cloudant, both of which are running on the IBM Cloud Platform ( nee Bluemix ).
Having spun up an instance of Cloudant, and worked out how to "feed" it using RESTful APIs, via cURL, I now wanted to find out how one can achieve integration between IIB and Cloudant.
This was of immense help: -
IBM Integration Bus v10 tutorials on Github
specifically this tutorial: -
Using a LoopBack Request node to insert data into a Cloudant database
and this: -
Using some of the more advanced features of the LoopBackRequest node
Tutorial: Installing LoopBack connectors
IIB V10.0.0.6 Loopback Request node using MongoDB and Cloudant tutorial
One of the key requirements is to install a Loopback Connector for IBM Cloudant, as per this exception: -
BIP2087E: Integration node 'TESTNODE_Dave' was unable to process the internal configuration message.
The entire internal configuration message failed to be processed successfully.
Use the messages following this message to determine the reasons for the failure. If the problem cannot be resolved after reviewing these messages, contact your IBM Support center. Enabling service trace may help determine the cause of the failure.
BIP4041E: Integration server 'default' received an administration request that encountered an exception.
While attempting to process an administration request, an exception was encountered. No updates have been made to the configuration of the integration server.
Review related error messages to determine why the administration request failed.
BIP3879E: The LoopBackRequest node received an error from LoopBack when attempting to connect to the data source name 'CLOUDANT'. Detail: ' WARNING: LoopBack connector "cloudant" is not installed as any of the following modules: ./connectors/cloudant loopback-connector-cloudant To fix, run: npm install loopback-connector-cloudant --save '.
An error was received when establishing the connection to the configured LoopBack connector data source.
Check the error information to determine why the error occurred and take the appropriate action to resolve the error. The error detail is a LoopBack connector error message.
BIP2871I: The request made by user 'Dave-PC\Dave' to 'change' the resource '/LoopBack/Loopback_Cloudant' of type 'MessageFlow' on parent 'default' of type 'ExecutionGroup' has the status of 'FAILED'.
Having downloaded/installed NodeJS ( node-v8.11.2-x64.exe ) on the Windows VM, I tried/failed to work out how to resolve the missing dependency.
This gave me the clue: -
Preparing the Integration Node runtime environment to connect to Cloudant
Namely, I needed to navigate to the appropriate directory under the IIB Toolkit: -
cd C:\ProgramData\IBM\MQSI\node_modules
notepad C:\ProgramData\IBM\MQSI\package.json
{
"name": "system32",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"loopback-connector-cloudant": "^2.0.5"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
npm install loopback-connector-cloudant --save
and, for good belt n' braces reasons, restart the Integration Node.
Once I did this, I was able to run the flow using the Flow Exerciser: -
and insert data into Cloudant using the Create operation: -
or retrieve data from Cloudant using the Retrieve operation: -
which is nice :-)
Final consideration, I needed to create a datasources.json configuration file here: -
C:\ProgramData\IBM\MQSI\connectors\loopback
{
"CLOUDANT":
{
"name": "bluey",
"connector": "cloudant",
"username": "2ha2294a-fd6f-42a5-a220-a4221ef51df0-bluemix",
"password": "5322e20e538422a92f2eaca69db094883125cdfa4db28c20dd82bc3662161108",
"url": "https://2ha2294a-fd6f-42a5-a220-a4221ef51df0-bluemix:5322e20e538422a92f2eaca69db094883125cdfa4db28c20dd82bc3662161108@2ha2294a-fd6f-42a5-a220-a4221ef51df0-bluemix.cloudant.com",
"database": "bluey"
}
}
{
"name": "bluey",
"connector": "cloudant",
"username": "2ha2294a-fd6f-42a5-a220-a4221ef51df0-bluemix",
"password": "5322e20e538422a92f2eaca69db094883125cdfa4db28c20dd82bc3662161108",
"url": "https://2ha2294a-fd6f-42a5-a220-a4221ef51df0-bluemix:5322e20e538422a92f2eaca69db094883125cdfa4db28c20dd82bc3662161108@2ha2294a-fd6f-42a5-a220-a4221ef51df0-bluemix.cloudant.com",
"database": "bluey"
}
}
1 comment:
This is really cool! congrats and nice article!
Post a Comment