Customizing Ribbon configuration with Zuul/Eureka - netflix-eureka

I am using Spring Cloud Netflix Zuul along with Eureka in our environment.
I assume internally Zuul uses Ribbon to do the load balancing after obtaining the instance info from Eureka.
I want to customize ribbon configuration when used with Zuul/Eureka.
I am not sure how to configure Ribbon when using with Zuul/Eureka to change to a different load balancing strategy.
If anyone has used that can you share details on the same.

You can simply specify your specific rule in configuration properties, for example:
zuul.routes.example-service.path=/example-service/**
zuul.routes.example-service.serviceId=example-service
example-service.ribbon.NFLoadBalancerRuleClassName=com.netflix.loadbalancer.RetryRule
There is much more settings that you can define:
NFLoadBalancerClassName
NFLoadBalancerPingClassName
NFLoadBalancerRuleClassName
NIWSServerListClassName
NIWSServerListFilterClassName

Related

Spring Cloud Ribbon Load balance sequence

Could anyone with Ribbon experience help me check if my understanding of Ribbon correct.

HATEOAS paths are invalid when using an API Gateway in a Spring Boot app with context-path

I have a spring boot 2.0.2 web application behind a zuul gateway. My application uses spring hateoas links. Also my application has context-path set lets say xxx.
When queries are made through zuul gateway, hateoas links become invalid. Reason is the following:
Lets say a make a call https://localhost/serviceName/service-context-path/path. I would require my heteoas links become i.e.
https://localhost/serviceName/service-context-path/path/
however, these links become: https://localhost/service-context-path/path/.
Ihave made search and found in stack overflow this link (HATEOAS paths are invalid when using an API Gateway in a Spring Boot app)
Indeed, add-proxy-headers by default true sends X-FORWARDED-PREFIX (allong host, etc) which i guess it was communitys intention to fix this problem. But... when i debug my application i reached this method org.springframework.web.servlet.support.ServletUriComponentsBuilder#fromContextPath, with java doc part the following:
As of 4.3.15, this method replaces the contextPath with the value "X-Forwarded-Prefix" rather than prepending, thus aligning with {#code ForwardedHeaderFiller}.
This means the following, when X-FORWARDED-PREFIX is present, application context is replaced from the zuul's prefix which is the serviceName. I guess uul developers on their side cannot know the application context and on the other side, org.springframework.web.servlet.support.ServletUriComponentsBuilder#fromContextPath is compatible with the corresponding specification.
Question: How do i proceed? i for sure wish my hateoas links to be correct when i use zuul
My quess is that there is no solution here.
Proper way is to avoid usage of zuul and move to Spring cloud gateway.

How can I prevent Service Fabric from generating Default Services for Actors

Everytime I build my Service Fabric solution in Visual Studio, the ApplicationManifest and ServiceManifest are modified and Default Services entries are added for all Reliable Actors in my solution.
How can I prevent that?
Note: Default Services are not created for the Reliable Services which is what I am expecting.
Ultimately, our goal is to create an "empty" Named Application instance every time a new tenant/customer signs up through our Web Portal (one instance of the application type per tenant).
Then the tenant can enable/disable features through our Web Portal which translates to creating/removing an instance of an Actor/Service types inside the tenant's application instance.
Thanks for providing guidance if this is not the right way to implement isolation in multi-tenancy scenario in Service Fabric.
Thanks Kiryl... I finally found an article that explains the way to disable the generation of in the application manifest while building the Service Fabric application in Visual Studio.
Open the .csproj of the Actor project and modify the following property to "false"
<UpdateServiceFabricManifestEnabled>false</UpdateServiceFabricManifestEnabled>
You can find the article here: https://github.com/Azure/service-fabric-issues/issues/271
Cheers!
I'd say you can't... There was a time I was trying to set my own settings for partitioning scheme(switch the default one to Named partitioning or change low/high key for UniformInt64) but VS was overriding them no matter what I did. Turned out it was an expected behavior as I 'misunderstood' how partitioning is applied with actors, so VS gladly was 'fixing' my mistakes. See Can't change partitioning scheme for actors for the reference. The bottom line is, seems like VS adjusts Actors Service manifest to preserve the holy purpose of actors as a pattern.
As for multi-tenant application, consider deploying a separate app type with its own settings per each customer/tenant.
P.S. I was able to get what I want by deploying Actors Service manually rather than via VS, but that's another story.

Using Hystrix with Spring Data Repositories

Given that one of the main benefits of Spring Data and the related REST repositories is that most of the time the developer doesn't have to worry about the underlying implementations, is there an out-of-the-box way to leverage the Spring Cloud Netflix libraries, specifically the Hystrix annotations in this case, without extending every call in the provided Repository interfaces or creating my own implementation?
Currently you need to wrap calls in another service whose methods are annotated with #HystrixCommand. Because of the way both Spring Data and the Hystrix Aspect work (they both create proxies), there would need to be specific integration in Spring Data for #HystrixCommand. #ccit-spence is right, you really want to put #HystrixCommand on the services calling into a Spring Data REST repository.

Adding custom metadata in alfresco

I added custom metadata through xml configuration specified in their wiki ... I could see the aspect I added in the /share application in manage aspects but it is not listed in /alfresco app and when i am uploading the document using the rest api it says unable to find the field i added ..
Share and old Alfresco Web Client have different configurations.
Check these resources out for more information:
http://wiki.alfresco.com/wiki/Web_Client_Customisation_Guide
http://wiki.alfresco.com/wiki/Displaying_Custom_Metadata
Please read this tutorial which covers creating custom content types and aspects and exposing those to both the Share (/share) and Explorer (/alfresco) web clients.
It sounds like you may have multiple problems, though, beyond configuration, because the REST API should be able to see your custom model, if it is defined correctly, regardless of whether or not it is configured in either of the two web clients.