More than one server

I have a greater system. A microservice system.


My servers have to communicate with each other.  The first servers are working fine. But now, I have to communicate from one server to another server.
The problem, I must use the service-interface from the other server. I have now two (or more) service-interface units in my project.
It compiles.
But if I call $model with my REST-Debugger, I see, that I have all service functions of all interface units.

First, the name of the URIPathSegment was the same. And i got a path/parameter error. After a long search, I found the problem, that I have 2 controllers with the same name.

If I take different names, I think, it could bo work. But is that alright?
I don't want to see the functions of the other interfaces (of the other servers)


Here are sample units. 
For example: My XDATA-REST-Server PERSON uses the XDATA-REST-Server KERNEL respectively the interface unit and some client-functions to communicate with.


unit Person.func;


interface


uses
  System.Classes, System.JSON, Generics.Collections, Aurelius.Criteria.Base, XData.Service.Common;


const
  guid_Person = '2437ce95-2785-42bd-b992-f81aacfc50bb';


  vcPerson_Productversion = '01.00.00';
  vcPerson_CurrentVersion =  10000;  // aktuelle Version für die REST Schnittstelle
  vcPerson_OldestVersion  =  10000;  // älteste noch unterstützte Version


  vcPerson_v1 = 10000;   // Implementierung v1 geht bis einschließlich diese Version
  //Beispiel: vcKernel_v2 = 10502   // Implementierung v2 geht bis einschließlich Version 1.05.02 = 10502


type
  [ServiceContract]
  [URIPathSegment('func')]
  IPersonFunc = interface(IInvokable)
    ['{9B26D6A2-D54D-444E-BE24-11328C2D99B9}']

    function SearchCount ( const Param: TJSONObject) : TJSONObject;  
    function Search      ( const Param: TJSONObject) : TList<TCriteriaResult>;  
  end;


implementation

initialization
  RegisterServiceType(TypeInfo(IPersonFunc));
end.



unit Kernel.func;


interface


uses
  System.JSON,  XData.Service.Common,  Kernel.dbEntities;


const
  guid_Kernel = '75CBA3B2-0970-4278-9170-AEE6920587B1';


  vcKernel_Productversion = '01.00.00';
  vcKernel_CurrentVersion =  10000;  // aktuelle Version für die REST Schnittstelle
  vcKernel_OldestVersion  =  10000;  // älteste noch unterstützte Version


  vcKernel_v1 = 10000;   // Implementierung v1 geht bis einschließlich diese Version
  //Beispiel: vcKernel_v2 = 10502   // Implementierung v2 geht bis einschließlich Version 1.05.02 = 10502


type
  [ServiceContract]
  [URIPathSegment('func')]
  IKernelFunc = interface(IInvokable)
  ['{5CD9E9DD-4CF2-44B7-9CDE-63CED808970F}']

    function InstallService   ( const Param: TJSONObject)  : TJSONObject;  
    function UpdateService    ( const Param: TJSONObject)  : TJSONObject; 
    function UninstallService ( const Param: TJSONObject)  : TJSONObject;  
    function StartService     ( const Param: TJSONObject)  : TJSONObject;  
    function StopService      ( const Param: TJSONObject)  : TJSONObject;  
    function ShutDown         ( const Param: TJSONObject)  : TJSONObject;  
    function CheckSystemRunningServices ( const Param: TJSONObject)  : TJSONObject;
    function CheckStartServices         ( const Param: TJSONObject)  : TJSONObject;  
  end;


implementation

initialization
  RegisterServiceType(TypeInfo(IKernelFunc));
end.



Perhaps, I must use compiler directives

and only use the

{$IFDEF Kernel}

 RegisterServiceType(TypeInfo(IKernelFunc));
{$ENDIF}

if the compiled programm ist the owner server

That's one option. 

A second one is to move RegisterServiceType calls to a function, and only call that function in the server.
A third one is to use multi-model design, putting each interface in a different model:

http://www.tmssoftware.biz/business/aurelius/doc/web/multi-model_design.html
http://www.tmssoftware.biz/business/xdata/doc/web/client_and_multi-model.html