Scenarios for Business Solutions

Information distribution

Information distribution is a ”fan-out” pattern, where data such as machine configuration- and reference data are disseminated from a central system to many devices, sites or stores. Below are some more detailed scenarios with samples to provide you with guidance of how it can be implemented using microServiceBus.com©. Please be advised that many samples use simulator services to interact simulate real sensors or services. These can all be updated to work in production. 

Sending configuration information to machines

All kinds of machinery are controlled be microcontrollers similar to any modern car. Like cars, these machines have certain configuration stored locally. The configuration can control anything such as performance, usage, water levels etc.

In many of these cases the configuration needs to be updated, sometimes because over time we’ve learned more about the behavior of the machine or how it’s used. In other cases we might want to change the behavior of the machine aligned with a payment model.

In such cases we might want to send messages routed to groups of nodes depending on a model number.

Reference data

When dealing with distributed systems such as with Point-of-Sales or journal system, you often need reference data to be synchronized across all sites, stores or clinics. This could be customer-, product- or accounting data for instance.

In these cases, it’s important that the micro services on the nodes can interact with the cash register or the journal system. As microServiceBus.com© is based on node.js, with an enormous community and overflow of extensions chances are someone have already solved your problem. On top that,  microServiceBus.com© already comes with micro services to interact with most common databases on the market such as Oracle, Microsoft SQL, MySQL, MongoDb and more.

Sample Description

This sample will illustrate a scenario where we push price updates to a cash register. As the register receives the update, you will receive a confirmation saved in a file location.

The solution is implemented using three micro services:

  1. File inbound service

    This will serve as the starting point of our scenario. You will drop a file with the updated price information addressed to a specific node.

  2. Cash register service (simulator)

    This service will simulate the cash register, and will receive price updates, and respond with an acknowledgement.

  3. File outbound service

    This service will save the acknowledgement from the cash register service (step 2), to a file location.

The interesting part of this sample is that you will route the incoming PriceUpdate.json file to a dynamically configured node (on the Cash Register service). This will simulate sending messages to a node defined at runtime. Open and examine the Node setting of the Cash Register service. Please note that the Node is set to “[targetRegister]”. The brackets indicate that name of the node should be found in the message itself.

Setup sample

  1. Download the sample
  2. Navigate to the Flow page
  3. Click the “Create” button on top
  4. Give the Flow a name, e.g “Sending price updates to cash register
  5. Click Save
  6. After the Flow designer opens, click the “Import” button and select the file you downloaded in step 1.
  7. Continue to save the Flow, start nodeJs-00001
  8. If you haven’t set up the nodeJs-00001 node before. Follow the instruction from the “Install a node” documentation.
  9. Start the node

Run Sample

Both file locations of in this sample are located in the /sample/ReferenceData/ relative your node installation path.  

  1. Create a text file and copy the content below and save the file as PriceUpdate.json at the /sample/ReferenceData/ folder.

{

  "targetRegister": "nodeJs-00001",

  "priceUpdates": [

    {

      "article": 1,

      "name": "GINGER SCALP CARE SHAMPOO",

      "price": "15.95"

    },

    {

      "article": 1,

      "name": "BANANA CONDITIONER",

      "price": "21.32"

    },

    {

      "article" : 1,

      "name" : "COCONUT OIL HAIR SHINE",

      "price" : "12.95"

    }

  ]

}

The JSON message above is the price update. The targetRegister field indicates which node or cash register the file is addressing. The next field is an array of price updates.

2. Copy the file to the /sample/ReferenceData/in folder.

The file should get picked up by the File inbound service. As the node of the next service is not defined ([targetRegister]), the current node will look in the message for the value of the targetRegister field.

3. After the Cash Register service has processed the message, it will submit an acknowledgement message back to the node.

4. The acknowledgement message is forward to the File output service which will save the message to a file in the /sample/ReferenceData/in folder.

Optional

To make this a little more interesting, create one more node in the portal and call it “nodeJs-00002”. Start the node and update the message setting the targetRegister field to “nodeJs-00002”

Commands and Collect on-demand

In other cases you might want to send a command to perform a specific action. Such as to turning on an air-condition, start an engine or to increase the speed of a conveyor belt.

There might also be cases where you’d like to query a node for some information, such as getting the temperature of a certain sensor or get the speed of a conveyor belt. These kinds of commands use a two-way exchange pattern.

Sample Description

This sample simulates a three scenarios where we interact with a control unit accessing a number of conveyor belts. All scenarios are implemented by using an inbound REST service, which lets us query and send configuration settings to one or more belts.

The solution is implemented using three micro services:

  1. REST inbound service (two-way)
    This will provide a two-way interface which we can use to access the control unit accessing the conveyor belts.
  2. JavaScript service
    The JavaScript service will transform the incoming message to the message expected by the control unit.
  3. Conveyor belt service (simulating the control unit)
    This service simulates the interaction with the conveyor belts. It allows us to query all or individual belts for configuration data, or send configuration updates to individual belts.

To run this sample, we recommend you to use some Postman (Crome Add-in), Fiddler or some other tool that lets you call REST services.

Setup sample

  1. Download the sample
  2. Navigate to the Flow page
  3. Click the “Create” button on top
  4. Give the Flow a name, e.g “Commands and Collect on-demand sample
  5. Click Save
  6. After the Flow designer opens, click the “Import” button and select the file you downloaded in step 1.
  7. Continue to save the Flow, start nodeJs-00001
  8. If you haven’t set up the nodeJs-00001 node before. Follow the instruction from the “Install a node” documentation.
  9. Start the node

When you start the node, it will examine the flow and start all services. Since one of the services is a web service, the node will host the service at http://localhost port 80. If you’re already using port 80 you can change the port by clicking the Edit link on the node page.

Run Sample

Scenario #1

In the first scenario, we will query all belts for their current configuration. We will do so by calling the REST service using a GET request:

GET http://localhost/beltservice

This should return a list of configurations for all belts

Scenario #2

Next, we are querying individual belts. This is done the same way as with Scenario #1, but using a query parameter called “belt

GET http://localhost/beltservice/belt=2

This call should give you configuration for a specific belt.

Scenario #3

Lastly, you’re going to update the configuration of one of the belts. This is done using a PUT HTTP verb:

PUT http://localhost/beltservice

Body:

{

   "belt" :  "2" ,

   "load" : 37,

   "speed" : 4,

   "range" : 82

}

This should return a message confirming the configuration update.

Data collection

Telemetry information & Big Data

Data collection is the classic use-case presented in every IoT scenario and is all about collecting large amount of information from many devices and forwards the data to some kind of stream analytics system.

Although microServiceBus.com© are ideal for handling massive amount of data, it does not come with any data store or analytics service. –However, it does integrate with most data and stream analytic tools on the market.

Point-of-sale data

Point-of-sale data is just one example of on-site data which you might consider harnessing to a central system. Through micro services running on nodes installed on every store you can collect data extract from on-premise databases and systems and forward it to line-of-business systems. microServiceBus.com© supports most open standards of communications, but also tightly integrates with traditional enterprise application integration (EAI) systems such as Microsoft BizTalk Server, MuleSoft and IBM WebSphere.

Alerts

Another often mentioned request is the support for alerts. This scenario is from a technical perspective identical to the Telemetry information scenario above, but often with different actions and message routes depending on numerous rules and conditions.

Integration

Line-of-business systems

microServiceBus.com ® is able to integrate with much more than IoT devices. Through its built-in services you can access on-premise- or cloud based LOB system such as O365 and SalesForce. Part from this, it will also seamlessly integrate with other EAI platforms such as BizTalk Server.

Databases & Queues

microServiceBus.com ® comes with support for interacting with most common databases on the market such as Oracle, MS SQL, My SQL, MongoDB, Orchestrate.io, AWS Dynamo DB and Azure DocumentDB. You can also use it to access queues and topics using the open AMQP protocol.

Routing & rules

Through the messaging capabilities of microServiceBus.com ® you can transmit messages to particular nodes or groups of nodes. This will come useful when interacting with specific sensors.

Sample Description

This sample will demonstrate how you can use routing to target different nodes based on the content of the message payload.

In this sample you are going to receive temperatures from a thermometer sensor, and you are routing the incoming reading depending on the temperature. If the temperature exceeds 30 degrees, the message is being sent to a “processHigh” services. If it’s less or equal to 30 degrees, it’s sent to “processNormal”.

  1. Temperature inbound service (simulator)
  2. File outbound service processing HIGH temperatures
  3. File outbound service processing NORMAL temperatures

Examine the flow by right-clicking any of the outbound File services. Select the Routing expression, to examine the routing rule.

When the Flow is executed the expression is going to evaluate the outcome of the route variable. In the expression below you can see the route variable is evaluated whether or not the message.temp value exceeds 30 degrees.

Setup sample

  1. Download the sample
  2. Navigate to the Flow page
  3. Click the “Create” button on top
  4. Give the Flow a name, e.g “Routing temperature readings
  5. Click Save
  6. After the Flow designer opens, click the “Import” button and select the file you downloaded in step 1.
  7. Continue to save the Flow, start nodeJs-00001
  8. If you haven’t set up the nodeJs-00001 node before. Follow the instruction from the “Install a node” documentation.
  9. Start the node

Run Sample

The outbound File services should have created two folders in your node installation folder:

  • output/routingSample/HIGH
  • output/routingSample/NORMAL

After you’ve started the node, the thermometer simulator will start pushing new readings every 10 seconds. Since this is a simulator, the actual readings are randomized so it might take a minute or so until you have messages coming out in both folders.

Optional

In this sample all services are running in the same node (nodeJs-00001). To take this further, update the flow and set the nodes to run on different machines or devices. 

Security & Scale

Security is core with microServiceBus.com ® and can enabled you to secure your payloads and nodes using your own certificates.