Build solutions in ELMA365 / Custom microservices

Custom microservices

For some unconventional and technically complex solutions, you may need to develop a separate service. For example, to process data or to manage heavy use of a server’s resources (processor, memory, and video cards).

The ELMA365 platform has all the things needed to unite all the existing systems and services into a single structure. Communication can be set up in two directions.

An external service calls ELMA365

To set up this type of communication, you can use the web API available on the platform and custom API methods that a user can create in a module. Common communication scenarios in this case are the following:

  • Getting app items to store and process them.
  • Updating values in app items based on events in an external system.
  • Starting a process or creating an app item based on an event in an external system.
  • Storing and processing files and documents.

Thanks to scripts and TypeScript SDK, users can create their own API methods in modules. These methods can execute a large part of the required logic within the platform. This allows minimizing the number of calls from the external system.

Processes and widgets calls an external system

For this type of communication, you can use TypeScript scripts in processes and widgets. They will be executed on the platform and used to call the external service. To call a service using the HTTP protocol, use the fetch method. With this method you can quickly call any external service and read the response right away.

For example, the following script allows you to get the US dollar exchange rate:

const res = await fetch("http://www.floatrates.com/daily/usd.json");
if (res.ok) {
   const ratesData = await res.json();
   const eurData = ratesData.eur;
   data.items.push({ name: 'EUR', price: eurData.rate.toString() });
}

The fetch() method also supports additional parameters if you need a more complex request:

const res = await fetch("https://my.server.name/api/products", {
    method: "POST",
    headers: {
        "Authorization": 'Bearer SOME-TOKEN-HERE',
    },
    body: JSON.stringify({
        name: "New product",
        cost: 13.20,
    })
});
 
if (!res.ok) {
    // Error handling
}
 
const resData = res.json();

As a result, the platform can interact with your service in various situations:

In the On-Premises edition, there are two additional possibilities for integration with external services:

Deployment and support of a service

You should note that ELMA365 does not regulate development, deployment, support, and security control methods you use for your custom services in any way. However, we can provide some guidelines for locating and isolating services in a local cluster based on our own experience.

  • Develop your service using Docker containers. This approach allows creating services that can be replicated and updated. They can be quite easily installed to a Kubernetes cluster, which is helpful as Kubernetes is the system’s main orchestrator.
  • Locate your service in a DMZ. Don’t throw any ports or access points of the service publicly unless absolutely necessary. Comply with OWASP.
  • Preferably study the guidelines for cloud application development in this article: The Twelve-Factor App.

Found a typo? Highlight the text, press ctrl + enter and notify us