I have a few Zuul routes defined and everything works great. The hystrix stream is empty and according to this the reason is that I am not using a service.
So I would like some help on how I could work around this. I do not have Eureka (and do not wish to start using for this simple app). Is there some way to get the hystrix stream with url instead of serviceId?
Any help will be much appreciated.
Here are example routes I have configured. The URL placeholders come from my profile specific configs.
zuul.routes.v1stores.path=/v1/stores
zuul.routes.v1stores.url=${target.url}
zuul.routes.v1order.path=/v1/order/**
zuul.routes.v1order.url=${target.url}/v1/order
Currently using the url attribute, sets up zuul to NOT use Hystrix. You need to use ribbon to access the Hystrix functionality in Zuul. To do so, you could do something like this (see docs):
zuul.routes.v1order.path=/v1/order/**
zuul.routes.v1order.serviceId=v1order
v1order.ribbon.NIWSServerListClassName=com.netflix.loadbalancer.ConfigurationBasedServerList
v1order.ribbon.listOfServers=${target.url}
Related
I'm using newest springdoc library to create one common endpoint with all Swagger configurations in one place. There're a bunch of microservices deployed in Kubernetes, so having documentation in one place would be convenient. The easiest way to do that is by using sth like this (https://springdoc.org/faq.html#how-can-i-define-groups-using-applicationyml):
springdoc:
api-docs:
enabled: true
swagger-ui:
disable-swagger-default-url: true
urls:
- name: one-service
url: 'http://one.server/v3/api-docs'
- name: second-service
url: 'http://second.server/v3/api-docs'
and it works great, I can choose from list in upper right corner.
The problem is that it doesn't work through proxy. According to documentation I need to set some headers (https://springdoc.org/faq.html#how-can-i-deploy-springdoc-openapi-ui-behind-a-reverse-proxy) and it works for single service called directly. But when i try grouping described above, headers are not passed to one-service or second-service, and they generates documentation pointing to localhost.
I suspect I need to use grouping (https://springdoc.org/faq.html#how-can-i-define-multiple-openapi-definitions-in-one-spring-boot-project) but I miss good example, how to achive similar effect (grouping documentation from different microservices). Examples shows only one external address, or grouping local endpoints. I hope, that using this approach, I'll be able to pass headers.
The properties springdoc.swagger-ui.urls.*, are suitable to configure external (/v3/api-docs url), for example if you want to agreagte all the endpoints of other services, inside one single application.
It will not inherit the proxy configuration, but it will use servers urls defined in your: servers http://one.server/v3/api-docs and http://second.server/v3/api-docs.
You want to have a proxy in front of your service, it's up to your service to handle the correct server urls you want to expose.
If you want it work out of the box, you can use a solution that handles proxying and routing like spring-cloud-gateway
#RefreshScope and /refresh not working for updating multiple service instance i know this can be done using spring cloud bus but due to some constraint i can not opt for that is there any alternatives
Consider using Ribbon to determine the available instances and then call refresh event for all of them. I have not tried this, but seems to be possible as I read in the documentations
I have an application in the service fabric and I'm going to upload another one.
I wonder if it's possible to assign different names to each application.
With an application, I access using the address:
http://sf-spartan.eastus.cloudapp.azure.com
You can configure for access to look like this:?
http://application1.sf-spartan.eastus.cloudapp.azure.com
or
http://sf-spartan.eastus.cloudapp.azure.com/application1
Sure, have a look here. Use the ApplicationName argument to define it.
Every application instance you create must in fact have a unique name.
You can reach your application instance through its url by using a reverse proxy. (either the built-in one, or a custom one like Traefik)
Usually, the application and service name are part of the url, e.g.:
http://mycluster.eastus.cloudapp.azure.com:19081/MyApp/MyService
This does require a web based communication listener.
Event more info here.
I am trying to explore the opportunity to build a connector for CouchDB for Loopback.io.
I know CouchDB has a REST interface but - for some reason - when putting the baseURL of my Couch local server into a Rest connector in Loopback, I get an error back on some headers missing in the request from Couch.
Since some useful functions could be added to exploit views and so on, I am exploring the loopback-connector-couchdb creation.
So easy question is: what are the methods that a connector needs to implement to map exactly to the standard API endpoints offered by Loopback.io for a model?
Basic example:
POST /models (with payload body) --> all good on the "create" function of the connector
DELETE /models/{id} --> I get an error saying that the destroyAll function is NOT implemented (correct) but the destroy function IS implemented instead...
what is the difference between HEAD /models/{id} and GET /models/{id}/exists in terms of the functions called?
I try to verify the existence of the model created (successfully) in CouchDB via ID and use GET /models/{id}/exists and instead of having the function "exists" called in the Connector, another function called "Count" is called instead.
It is as if some but not all functions are mapped to the connector (note, I am not using the DataAccessObject property of the connector, as that seems to be more for additional methods, so to speak... and one of the methods does work!)
...I am confused!
Thanks for any guidance. I am trying to follow this, but i can't easily map standard API endpoints to the minimum functions of the connector (see point 2 above, for instance)
Building a connector - Loopback.io documentation
I would suggest playing with the API explorer to figure out your endpoints.
Create a sample LoopBack project via slc loopback
Create some models via slc loopback:model
Start the app via slc run
Browse to localhost:3000/explorer
In there you can see all the endpoints that are automatically generated by LoopBack. Like if you click the GET endpoint for a model, it will show the query as GET /api/<modelname>.
In twitter's finagle, there is a filter concept, they can be composed and applied on service to add function to the service, like adding timeout or retry, the concept and example can be find here: http://twitter.github.io/finagle/guide/ServicesAndFilters.html
In playframework, you call a 3rd party service like this:
WS.url(requestUrl).get
The network is unstable, one of the solution is to add retry mechanism, when get failed, we can resend the url to retry.
We know how to add a retry for this case, I just want to know whether there is similar filter concept in playframework, so you can combined them and add new functionality to WS calling.
Out of the box in Play there are no such filters. You can however add them yourself using Action composition as described on the official documentation.