User can use local registry mechanisam and can connect server endpoints without using service center. For local registry mechanism user should provide the local registry file at consumer side. User can start provider service and get the provider schema file and put at the consumer side. Consumer will use local registry function and it will connect the server end points.
Please find the details as follows.
see Precondition
Add local registry file registry.yaml :
localserv: - id: "100" version: "0.0.1" appid: localservreg schemaIds: - localservregistry instances: - endpoints: - rest://localhost:8080
Add the following code at the beginning and end of the service consumer Main function
public class MyClient { public static void main(String[] args) { //"yourregistry.yaml" should be put in resource directory System.setProperty("local.registry.file", "yourregistry.yaml"); //your code } }
if file present in this path “local.registry.file” then registry mode is Local registry mode. It will not connect to service center.
Add provider's schema file at below location of consumer side
src/main/resources/microservices/{microserviceName}/{schemaId.yaml} -here microserviceName is servers's microservice name. Like this multiple schemaId files we can put in same location.
Run the consumer and verify the API's output.