webMethods Microgateway Help 10.3 | webMethods Microgateway Help | Publishing APIs to Runtime Service Registries | Publishing APIs to Runtime Service Registries
 
Publishing APIs to Runtime Service Registries
Microgateway provides capability to publish APIs to runtime service registries.
In a micro-service landscape service registries provide the information about service instances and their location or endpoints. This information enables the service discovery during runtime. Accordingly you can configure a Microgateway instance to register all its provisioned APIs to a service registry. During startup it generates one service registry entry per API. The endpoints of the registered APIs are based on the host and port of the Microgateway instance. Multiple Microgateway instances can expose the same APIs and register them to the same service registry. The service registry then shows all the endpoints of the given APIs. During shutdown a Microgateway instance removes the service registry entries it has generated.
Microgateway uses service registries in the following way:
*You can publish the provisioned APIs to service registries. This enables other applications to use the service registry to dynamically locate a Microgateway instance that provides that API.
Microgateway currently supports the following service registries.
*Eureka
Eureka is a REST-based service for locating services for the purpose of load balancing and failover of middle-tier servers. It has been primarily designed for applications in the AWS cloud.
*Service Consul
Service Consul is a tool for discovering and configuring services in IT infrastructure.
You can configure a Runtime service registry in Microgateway configuration. Use the config.yml file loaded with the --config <arg> (-c <arg> as shortcut) option.
A sample config.yml file is as follows:
#service registry
serviceRegestrys:
- #this symbols a list entry in yaml language, but must always be there,
even if you only use one registry
name: "Test"
serviceRegistryType: "SERVICE_CONSUL"
connectionTimeout: 30
readTimeout: 30
endpoint: "http://localhost:8500/v1"
coustomHeaders:
"X-Consul-Token" : ""
discoveryInfo:
path: "/catalog/service/{serviceName}"
httpMethod: "GET"
registrationInfo:
path: "/agent/service/register"
httpMethod: "PUT"
deRegistationInfo:
path: "/agent/service/deregister/{serviceId}"
httpMethod: "PUT"
-
name: "EurekaTest"
serviceRegistryType: "EUREKA"
connectionTimeout: 30
readTimeout: 30
endpoint: "http://localhost:9091"
discoveryInfo:
path: "/eureka/apps/{app}"
httpMethod: "GET"
registrationInfo:
path: "/eureka/apps/{app}"
httpMethod: "POST"
deRegistationInfo:
path: "/eureka/apps/{app}/{instanceId}"
httpMethod: "DELETE"
The table lists the variables in the config file, their description and their usage.
Variable
Description
name
Name of the registry
serviceRegistryType
Type of the registry.
It is eitherEUREKA or SERVICE_CONSUL
connectionTimeout
Specifies the time, in seconds, for which the microgateway tries to connect to the registry.
readTimeout
Specifies the time, in seconds, for which the registry tries to connect to the service endpoint.
endpoint
The path of the registry.
discoveryInfo
Information required to discover the registry
path. The rest path of the registry to register services
http Method. The rest path of the registry to register services.
registrationInfo
Information required to register services.
path. The rest path of the registry to register services.
http Method. The rest path of the registry to register services.
deRegistationInfo
Information required to deregister services.
path. The rest path of the registry to deregister services.
http Method. The rest path of the registry to deregister services.
customHeaders
A map of all custom Headers you need to reach your registry.
This is required only if you use consul with "X-Consul-Token" : "" as entry.
username
Optional. The username of the user authorized to to register services at your registry.
password
Required if you are using the username. Specifies the password of the user authorized to to register services at your registry.

Copyright © 2018 | Software AG, Darmstadt, Germany and/or Software AG USA, Inc., Reston, VA, USA, and/or its subsidiaries and/or its affiliates and/or their licensors.