To OVERVIEW

Client Library

Step 1. Setting up the project structure

Let’s do some small preparation of the project before we start writing the client library.

First, create the following directory structure to keep the source organized:

clients_prj
/src
  /version1
 /test  
   /version1

Prepare the initial project files, as described in the tutorial on creating a data microservice, for the language of your choice and perform the initialization process.

Since data is transferred between the client and the microservice using a specific protocol, this data must be defined for the client to work correctly. Some developers prefer to export general data structures, define external interfaces in a separate library, and use it on the client and on the server. However, to minimize the amount of libraries and simplify dependencies, we prefer to just copy the data structure from the microservice to the client library. This won’t cause any additional problems, since after changing the external interface, the client should be updated and retested anyways. 

Copy the files from the microservice’s data folder into the src/data/version1 folder of our client project. The microservice’s source code can be found at the following link

For “strongly typed” languages (e.g. Dart), you’ll have to import the data model files from the microservice using the import directive, instead of just copying the directory over. This will guarantee an exact type match.

Prepare the initial project files, as described in the tutorial on creating a data microservice, for the language of your choice and perform the initialization process.

Since data is transferred between the client and the microservice using a specific protocol, this data must be defined for the client to work correctly. Some developers prefer to export general data structures, define external interfaces in a separate library, and use it on the client and on the server. However, to minimize the amount of libraries and simplify dependencies, we prefer to just copy the data structure from the microservice to the client library. This won’t cause any additional problems, since after changing the external interface, the client should be updated and retested anyways. 

Prepare the initial project files, as described in the tutorial on creating a data microservice, for the language of your choice and perform the initialization process.

Since data is transferred between the client and the microservice using a specific protocol, this data must be defined for the client to work correctly. Some developers prefer to export general data structures, define external interfaces in a separate library, and use it on the client and on the server. However, to minimize the amount of libraries and simplify dependencies, we prefer to just copy the data structure from the microservice to the client library. This won’t cause any additional problems, since after changing the external interface, the client should be updated and retested anyways. 

Prepare the initial project files, as described in the tutorial on creating a data microservice, for the language of your choice and perform the initialization process.

Since data is transferred between the client and the microservice using a specific protocol, this data must be defined for the client to work correctly. Some developers prefer to export general data structures, define external interfaces in a separate library, and use it on the client and on the server. However, to minimize the amount of libraries and simplify dependencies, we prefer to just copy the data structure from the microservice to the client library. This won’t cause any additional problems, since after changing the external interface, the client should be updated and retested anyways. 

Prepare the initial project files, as described in the tutorial on creating a data microservice, for the language of your choice and perform the initialization process.

Since data is transferred between the client and the microservice using a specific protocol, this data must be defined for the client to work correctly. Some developers prefer to export general data structures, define external interfaces in a separate library, and use it on the client and on the server. However, to minimize the amount of libraries and simplify dependencies, we prefer to just copy the data structure from the microservice to the client library. This won’t cause any additional problems, since after changing the external interface, the client should be updated and retested anyways. 

Prepare the initial project files, as described in the tutorial on creating a data microservice, for the language of your choice and perform the initialization process.

Since data is transferred between the client and the microservice using a specific protocol, this data must be defined for the client to work correctly. Some developers prefer to export general data structures, define external interfaces in a separate library, and use it on the client and on the server. However, to minimize the amount of libraries and simplify dependencies, we prefer to just copy the data structure from the microservice to the client library. This won’t cause any additional problems, since after changing the external interface, the client should be updated and retested anyways. 

Now we’re ready to start writing our client library. When you’re ready, continue on to Step 2. Designing a Direct Client.

Если Вы сюда зашли это означает, что Вы уже ознакомились с основными терминами и структурой нашего инструментария, а также Вы приняли для себя решение, что простого примера “Hello, World!” Вам таки мало. В качестве полноценного примера раскрывающего в достаточной степени потенциал Pip.Services предлагаю разработать небольшой микро сервис по работе с Bluetooth маячками (Beacons). Сам по себе сервис очень прост, его цель состоит в том, чтобы обеспечить возможность работы с маяками, а именно:

- создавать, удалять, изменять или делать выборку из базы, т.е. самые обычные CRUD операции;

- рассчитывать центр координат между выбранными маяками;

- формировать информацию о сервисе и его статусу;

- логировать свою работу, а также собирать метрики

- осуществлять доступ к вышеперечисленным функция через REST API;

В завершении мы реализуем клиент для работы с нашим микросервисом и запустим его в контейнере Docker.

Реализация будет выполнена на всех поддерживаемых языках программирования, так что не забудьте выбрать интересующий именно Вас.

Структурно микросервис  будет выглядеть так:

Концептуально он не отличается от описанного “классического” варианта, такой же состав по компонентам и модулям, но если вдруг Вы не читали об этом, то вот ссылка