How WSO2 API manager implements microservices service discovery and service registry feature
How WSO2 API manager implements microservices service discovery and service registry feature
1 answer
-
answered 2018-05-16 09:28
Anuruddha Lanka Liyanarachchi
In API manager 3.0.0 release you can discover micro-services deployed in kubernetes.
https://docs.wso2.com/display/AM300/Discovering+Service+Endpoints
See also questions close to this topic
-
Where can I locate org.wso2.carbon.mit.OpenIDClientImpl?
I want to extend my key manager interface in wso2 api manager to connect it to a 3rd party azure interface. Any articles for this will be of great help.
-
Wso2 iot server with raspberry pi
This is the rest call for switch on off the bulb in raspberry pi.
<DeviceTypeConfiguration name="raspberrypi"> <Features> <Feature code="bulb"> <Name>Control Bulb</Name> <Description>Control Bulb on Raspberrypi</Description> <Operation context="/raspberrypi/device/{deviceId}/bulb" method="POST"> <QueryParameters> <Parameter>state</Parameter> </QueryParameters> </Operation> </Feature> </Features>
Here, the QueryParameter state stands for on & off. Like bellow.
curl -v -k -X POST "https://localhost:8243/raspberrypi/1.0.0/device/vf98e6a7atyp/bulb?state=off" -H "accept: application/json" -H "Authorization: Bearer beec80da-4d83-36a9-ad82-a33e5bdbad70"
But state can only take values on, off, ON, OFF. Can anybody tell me the name of the file which validates the value of state?
Because I want to add some more values other than on, off, ON, OFF.
Your help is very much appriciated.
-
Migrating WSO2 Definitions to AWS API Gateway?
Disclaimer: I have almost 0-knowledge on API development.
The objective is not to write API, but to port an existing definition.
Our current API Setup is a WSO2 Cluster API Manager residing in 3 different EC2 instances. One for both Publisher and Store, one for Gateway, one for Key Manager.
I've already took the time to review the config, so I at least know how the three components are 'talking' to each other.
What I've found out so far is that the API Definitions is somewhere in a path "*/gateway/repository/deployment/server/synapse-configs/default/api/" and there are XMLs in there which define the API. Reading through it, it seems that the fields are identical to the ones I can see in AWS API Gateway. So I know there must be a way to port them over.
However, beyond this, I'm completely lost as to what my next step is. How deep of an understanding of API should I have to be able to successfully do this? Is there a tool I can use to Import the API into AWS API Gateway? Or export from WSO2? I'm a bit stuck because the only thing that I can see right now that could help is for me to study WSO2 and API Definitions, but we don't exactly have enough time to do that with the time constraints we're given.
Any step in the right direction would be appreciate. Thank you!
EDIT: The reason that we're looking at migrating is because maintenance has been a nightmare. We've ran into so many critical problems regarding the API whenever we have to do some regular cleanups, not to mention that 3 EC2 Instances are costing us as well, so we're looking for a more lightweight, easier-to-maintain option.
-
Docker Container and Third Party Integrations?
I am a newbie to Docker & microservices, and trying to breakdown current monolithic services into smaller microservices using Docker containers. Idea is to logically divide monoliths into smaller independent modules as microservices and place each into separate Docker containers and manage it via Kubernetes for scaling.
Caveat is these services are either connected to third parties via REST or to mission critical voluminous databases. These dont have any local DB with them so i can't have any local microservice DB in bounded context.
I am trying to figure out best approach for refactoring
One approach i am thinking is to place DB connection code into separate container and call it from other containers.
Similarly place third party REST integration logic in a single container and call it from other containers.
Questions:
- Can i have a microservice without a database attached to it?
- Can i have containerized code as mentioned above and still be qualified for microservice?
- Can a microservice be used barely for integration?
- Does using docker containers qualify for this scenario?
-
How to rollback distributed transactions?
I have three different Spring boot Projects with separated databases e.g account-rest, payment-rest, gateway-rest.
- account-rest : create a new account
- payment-rest : create a new payment
- gateway-rest : calls other endpoints
at gateway-rest there is an endpoint which calls the other two endpoints.
@GetMapping("/gateway-api") @org.springframework.transaction.annotation.Transactional(rollbackFor = RuntimeException.class) public String getApi() { String accountId = restTemplate.getForObject("http://localhost:8686/account", String.class); restTemplate.getForObject("http://localhost:8585/payment?accid="+accountId, String.class); throw new RuntimeException("rollback everything"); }
I want to rollback transactions and revert everything when I throw exception at gateway or anyother endpoints.
How can I do that ?
-
Creating a controller method that saves an object within an object
I am trying to create a controller for a microservice in which a vehicle object is created, however within this vehicle object, we must save a registration object first. I am able to do the vehicle controller, but am unsure how to have the registration object saved within the vehicle object. Here is what the JSON objects should look like in the end.
JSON input:
{ "make":"Chevrolet", "Model":"Silverado 1500", "modelYear":2009, "registration": { "licensePlate":"TOWME2", "licensedTo":"Ford Towers" } }
JSON output:
{ "id":[auto-generated], "make":"Chevrolet", "model":"Silverado 1500", "modelYear":2009, "registration": { "id":[auto-generated], "licensePlate":"TOWME2", "licensedTo":"Ford Towers" } }
-
Can I specify the A Record Created From Creating an SRV record using AWS ServiceDiscovery Cloudformation?
I am creating a ECS service whose task definition is using network mode 'host' and thus when making DnsRecords in the ServiceDiscoveryNamespace, I need to make a SRV record instead of an A record.
This is the code in cloudformation
PollerServiceDiscovery: Type: AWS::ServiceDiscovery::Service Properties: Name: poll-srv Description: poll service DnsConfig: NamespaceId: !Ref ServiceDiscoveryNamespace DnsRecords: - Type: SRV TTL: 60 HealthCheckCustomConfig: FailureThreshold: 2
and this creates in my Hosted Zones, in Route53,
poll-srv.myfeederyzones. SRV 1 1 9160 8p2iest9-73d4-3taa-71xf-182e3x5cad11.poll-srv.myfeederyzones.
as you can see it autoassigned an A record 8p2iest9-73d4-3taa-71xf-182e3x5cad11.poll-srv.myfeederyzones. but I want this to be a name that I get to choose.
Is this possible in AWS Cloudformation?
-
Spring cloud configurable discovery client implementation
We currently use Eureka (and Ribbon) as our discovery mechanism for our Spring Cloud microservices by using the
@EnableDiscoveryClient
and having thespring-cloud-starter-netflix-eureka-client spring-cloud-starter-netflix-ribbon
dependencies. With the release of Spring Cloud Greenwich we are looking at moving to Kubernetes and using Kubernetes discovery (with Ribbon) instead. Ie we would keep the
@EnableDiscoveryClient
and have thespring-cloud-starter-kubernetes spring-cloud-starter-kubernetes-ribbon
dependencies instead as needed.
To enable initial testing of our microservices in the Kubernetes environment without having to branch all our projects and alter the dependencies, is there a way to include both sets of dependencies and switch between the implementations with configuration? Ie initally we would have eureka as the default and be able to override this to Kubernetes with config properties?
Possibly some variation of spring.autoconfigure.exclude might do this?
-
Fargate Service discovery
I have issues in Fargate with service discovery.
Starting from this template: https://github.com/pjlewisuk/fargate-refarch-cloudformation, I added a "private" service reachable only from other containers. I enabled service discovery on the private service.
Everything looks fine: the namespace is added in Routed 53 and I can see my discovery service with an instance registered in CloudMap.
Nonetheless, when I try to reach that private task from another one via (http://servicename.namespace), I always get 'getaddrinfo ENOTFOUND'.
Anyone has any idea how to fix it? Thanks in advance.