vFunction Logo

Inventory Controller Client

InventoryController-client is a client library for calling new entry points provided by InventoryController. It was auto generated by code-copy when we created the inventory-controller service.

Let’s review the code:

  1. There are DTO classes under src\main\java\com\oms\inventorycontroller\dto. These are the same DTO files used by the entry point fetchInventory in InventoryController service.

  2. Open the InventoryService class (same class name as the class that owns the entry point in the monolith):

    • The constructor gets the base URL of the InventoryController service
    • There is a fetchInventory operation that has the same signature as the corresponding operation of InventoryService in the monolith, it calls a second fetchInventory operation that uses DTOs objects. The second operation allows users of the client library to use a DTO interface directly if needed.
    • Note that we use okhttp3 framework to call the APIs

Compile InventoryController-client (mvn clean install via VSCode or command window) - the library should compile without errors.

vFunction Logo