How to get the instance ID of the specific ibm cloud app instance? - ibm-cloud

We started 2 instances of our IBM cloud app. Now, we want to trace which user belongs to which instance.
Cf Command or Javascript code needed

You can access various environment variables running in the cloud. For example using Node.js process.env.VCAP_APPLICATION displays (among other things) the unique application id and process.env.CF_INSTANCE_INDEX the index of the specific instance (0,1, etc.).
Here is a nice example from developerworks using an older API, but the generall approach is the same.

Related

Is it possible to include calls to the Microsoft Graph API from within a Windows Service application?

We currently have a web application which requires manual intervention in order to initiate the transfer of data from Azure Active Directory (via the Microsoft Graph API) to a local SQL Server database instance for archival and reporting purposes. This manual process is often run multiple times per day.
Our goal is to automate this data transfer process through use of a Windows service application; however, we have encountered an issue with instantiation of the Microsoft Graph client. The vast majority of the documentation available seems to presume the use of Microsoft Graph with a user interface (which the service app doesn't employ). Methods which work quite nicely with the typical MVC-based C# web application don't sit well within the more limited confines of a Windows service app.
Is this type of automation possible? If so, is there any sort of documentation available regarding the use of Microsoft Graph within a Windows service app?
Any assistance is greatly appreciated.
There is a documentation where is described how to call Graph API from a background service or daemon app without any user interaction. The same way will work for Windows service.
Documentation
Get access without a user

Store specific user input in Watson Assistant in a AWS RDS DB

I have created a DB instance using AWS RDS and was successful to connect the DB instance using DBeaver DB Tool. Also, created a simple table with few columns and inserted record in the table using DBeaver.
Now I am trying to develop dialog flow in Watson Assistant skill, where the Bot will ask the user some specific question and the user will provide the answers. The user input may be string or number anything. These inputs should be stored in the external DB like AWS RDS DB table and when user wants he/ she will ask the Bot and the Bot should be able to retrieve the stored data.
In a nutshell, need to create successful integration between Watson Assistant and AWS RDS DB for storing & retrieving the data.
I am quite new to WA and AWS both and hence need to know on how to build up the integration between Watson Assistant and AWS RDS DB and how to store/ retrieve the user inputs (as described above).
Can anyone kindly help me in this regard in detail with specific steps?
There is an IBM Cloud tutorial to hook up Watson Assistant to a database and the input is available as $input.
To connect to any external data source (except Watson Discovery, see "search skill"), you would need to define a webhook as shown in the linked tutorial. Implement a dispatch function (Cloud Functions, AWS Lambda, IBM Cloud Code Engine, ...) that takes the input and connects to the data source and performs the desired action.

Defining various DB & Salesforce access information in an external file and using them in Mule Anypoint Studio

I am running Mule Anypoint studio v6.2.4 under Windows. I have an application which gets data records from a SQL Server DB and populates them into Salesforce Org. The application was developed using examples and works fine in the current scenario of one DB and one SF parameters defined in a mule.properties file. This structure works but with serious limitations. Whenever a new DB instance is provided (DEV/QA/SAT/UAT...) and a different destination SF Org is chosen, all the mule applications need to be modified as the access parameters are defined in the property file.
I asked for help about how to dynamically define and use the access parameters in this question. (Defining various DB & Salesforce access information in Mule Anypoint Studio). While the proposed solution worked, it was still based on property file approach. Hence whenever a new DB or SF Org is to be worked on, all the mule applications will still need to be changed because of the property file approach.
A correct approach will be define all the access parameters in an external file. In the mule app, retrieve the appropriate access parameters based on DB name or Org name (provided as http query parameters). Use their values to initialise appropriate mule script variables. This way new DBs or Orgs can be added at will and mule app should work without any re-compilation or changes.
My mule app is batch based and config code fragment to access SQL DB is as follows::
<db:generic-config name="legacyDB" url="jdbc:jtds:sqlserver:${dbHost}:${dbPort};databaseName=${dbName};user=${dbUser};password=${dbPassword}" doc:name="Generic DB Config"/>
How would I accomplish it so that DB or SF access works as defined? Details will help me as I am not that proficient in Mule yet.
Thanks
Kishore
What about reading an external file using a JavaClass and returning a JavaObject to Mule, then you can easily manage those values.
Check this project and change the path in the LoadExternalFile.java to load your own json file. There is an example in the src/main/resources
https://github.com/angelalberici/external-property

Separate Cloudant Service from Bluemix

I was hosting my node app on Heroku connected to a mongolab for the DB.
Thanks to a few tips from here, I've deployed my app code to Bluemix. I moved mainly because I'm changing databases from mongodb to couchdb, and am hoping that Bluemix might have a faster connection due the relationship they have as both being IBM services.
Ok, now for the questions :p
First, since Cloudant was added to my app as a "service" it was generically provisioned and hence the username/pass/etc were generated. I assume I can also simply create my own separate Cloudant account and put an all of its settings into my Bluemix app manually. So, if I was to do that, to separately link up a separate Cloudantdb to my Bluemix app, would it be slightly slower or have any other negatives? I'm asking because maybe when it's auto-provisioned (and all done together), maybe it is configured in a way with few network hops/firewalls are skipped between the connections. Remember my initial motivation for trying out Bluemix was due to its relationship with Cloudant.
Second, if I decided to just stick with the auto-provisioned Cloudant db, how can I change the username? I've been playing with the interface and don't see that option anywhere. If I can or can't, I assume that I should be able to point my separate Heroku app to it using the same credentials Bluemix uses and it should work the same (as a separate db, just like I do with my single Mongolab and various PAAS providers).
Thanks for the info!
Paul
You can surely create your own separate Cloudant account, and then enter all of its settings into your Bluemix app manually. The connection speed would depend on your choice of data center locations (SoftLayer, Rackspace or Azure) when you created your Cloudant account. If you choose a SoftLayer data center, the speed would be faster than if you have chosen Rackspace or Azure due to the high-speed private network between all the SoftLayer data centers.
I'm not aware of a way to change usernames after it has been provisioned. You should be able to use those same credentials to point your Heroku app to.

How to store global parameter in IBM Community Server

I need to store a global parameter in IBM Sametime Community server which can be read by all the users through a sametime plugin.. Which the best way to do it?
The main task is to store a web address from where user can pick other additional config info for the plugin.
If you haven't already you will need the IBM Sametime Software Development Kit.
Look at the stjavatkdevguide.pdf on page 56 it discussed the Storage Service, this is what you will want to use. It explains how to
In a quick simple summary: You will want to create a StoragerServiceListener and add it to the Storage Service using addStorageServiceListerner(). Then to store an attribute, create an STAttribute and assign it your values, then store the attribute with storeAttr(). To Query it use QueryAttr().