Why Enterprise Applications Need IoT Data?
IoT Data + Enterprise Applications = Business Opportunities
New applications derived from IoT data creates opportunities to any industry because of the actionable information it offers, notably in the way companies can better manage their processes and improve decision making. Thanks to the valuable information derived from the IoT data, companies can increase the quality and efficiency of their business processes, such as their manufacturing processes and customer services.
IoT starts with installing sensors into products and connecting the products to the internet, companies can then determine when these products need service, maintenance and are coming to the end of their life-cycle.
Beyond this basic operational awareness use of the IoT data it is possible for companies to obtain accurate feedback on how, when and why their customers use their products. Companies want to predict product demand, and we can start by combining operational IoT data with the customer purchasing history to improve efficiency of production/supply chain scheduling. Operational IoT data can also be combined with related third party data source: for example, a vending machine supplier could use weather forecast data to order more drinks when sunny weather is forecast. Let’s add more data sources available by web API such as sporting events, traffic, news events and then correlate that data with an application providing predictive analytics to determine what, when and where inventory is needed before it runs out.
All the aforementioned examples require enabling collaboration and integration between IoT Data on the one hand, and enterprise applications such as ERP and CRM systems, on the other hand.
Connect the IoT Data to Enterprise Applications Leveraging Scriptr.io and Informatica
Scriptr.io is very efficient at handling the interactions with IoT device platforms through its many connectors and protocol bridges, and at facilitating the implementation of the IoT data transformation and structuring processes. As for connecting the latter to enterprise applications, we have chosen to leverage the powerful capabilities of Informatica Cloud. Informatic is a major supplier for the enterprise integration market. The Informatica Cloud is an enterprise integration platform as a service: it exposes Informatica’s best of breed enterprise connectors and ETL tools on the Cloud. In order to allow scriptr.io’s developers to connect to the enterprise, we provide simple connector to manipulate Jobs defined on Informatica Cloud. The following use case we will be demonstrating IoT collected from a virtual IoT enabled vending machine, combined with traffic data from TomTom and processed for Informatica Cloud to ultimately trigger an informatica Orchestrated SalesForce order. In a future blog post we will introduce the Xively IoT device management platform.
Example: Automatic Supply of Vending Machines
As a simple illustration, we consider the example of a vending machine that needs to be automatically refilled. To make things more interesting, we assume that the quantity of items to order is related to the quantity of remaining items in the vending machine and to the status of the traffic on the nearby road.
The supply process unfolds in four steps:
- Invoke an API exposed by the vending machine in order to retrieve the remaining items in stock
- Invoke the traffic API to get the current status of the traffic
- Build the order according to the remaining items in stock and the status of the traffic
- Trigger an ETL task on Informatica Cloud
Get the code
- Import the Informatica module from your scriptr.io workspace (click on +New Script > Import Modules, scroll to “Informatica” the click on “Import”)
- Check-out the code of the simple demo application
described in the paragraphs below
The automatic suppy process
This process is implemented as a script that orchestrates multiple services. Let’s check its different constituents:
- Main orchestration that executes the four steps of the process
// the automatic supply process orchestration function orchestrate() { var stock = getStock(); var trafficStatus = getTrafficData(); var order = buildOrder(stock, trafficStatus); return placeOrder(order); }
- Retrieving the stock status from the vending machine
// connect to vending machine and retrieve latest stock status function getStock() { var requestParams = { url: "http://vendingmachine1.scriptrapps.io/stock" }; var response = http.request(requestParams); var responseObj = JSON.parse(response.body); return responseObj.response.result; }
- Obtaining the current status of the traffic
// connect to Tomtom API to get latest traffic status at "location" function getTrafficData() { var tomtom = new traffic.Tomtom(); var status = tomtom.getTrafficStatus(location); return status; }
- Defining the order, based on remaining items in stock and traffic data
// determine the quantity of items to order according to the remaining quantities and the status of the traffic function buildOrder(stock, trafficStatus) { var order = {}; for (var item in stock) { order[item] = (MIN_ORDER - stock[item]) * (trafficStatus == "normal" ? 1 : (trafficStatus == "congestion" ? 1.25 : 1.5)); } storage.global.vendingmachine.order = order; return order; };
- Last step is using scriptr.io’s connector to trigger an ETL task on Informatica Cloud, which takes care of the propagation of our order into Salesforce
// trigger a task on Informatica Cloud that handles the integration with Salesforce function placeOrder(order) { var sessionMgr = new sessionMgt.SessionManager(); var user = sessionMgr.openSession(); // authenticate against Informatica Cloud var taskMgr = new taskMgt.TaskManager({sessionMgr:sessionMgr}); var task = taskMgr.getTask({name:"vending_machine"}); // get an reference to our ETL task return task.start(); // start the task on Informatica Cloud }
Designing our ETL task in Informatica Cloud account was only a matter of configuring components and notably, leveraging Informatica’s connector to Salesforce, for seamlessly triggering an order process. What the ETL task does is actually to invoke the orchestration we defined earlier in this post, transform the resulting order into a structure that Saleforce understands and push the latters to Salesforce using the Salesforce connector.
Check the complete code on Github