Open amarinso opened 7 years ago
Here is some input from my current engagement
Netflix OSS
We had a look at feign to. It offers some cool features, but it is very proprietary. I'm very sceptical if it is future-proof, looking at the discussions above. So we choose RestTemplate. It is not as comfortable as feign, but is very good integrated into spring cloud, too.
Openshift vs swarm vs kubernetes vs ...
Can we know a bit more about what kind of problems is that OpenShift engagement facing? Also some detail about what made kubernetes a failure for the PL... Kubernetes is maybe too low level thus my preference for OpenShift (two big customers here, Carrefour and Inditex are adopting it... and we know also that Santander Bank is using it since long time ago....)
As another alternative, checkout this article where I discovered about envoy http://blog.christianposta.com/microservices/microservices-2-0/
Also the REST client of choice may be questioned here as currently the default choice should be CXF as proposed per OASP.
Hi,
In our case (same as @amarinso Engagement) we could give some feedback about our (short) experience:
And something more that I possibly forgot.
In my project we are using yet another approach. We are using Apache CXF
also for the client. Also we have modularized the projects and have an api
module for each microservice. We do code first (current OASP4J documentation) instead of contract first (swagger) but that should not really matter. If one microservice/app depends on another, it imports its api
. Then we have a component (as a simple interface) that can instantiate the RestService from its interface via a single method defined in the components API. This internally solves service discovery, HTTP header control (e.g. correlation id), security/authentication (in our case passing JWT), error handling and exception mapping, etc. Also mocking in tests (JUnit) was addressed and solved in our project.
There are a lot of problems that need to be solved here and some might not even yet be aware of them. My proposal would therefore be:
RestService
to oasp4j-rest
.oasp4j
that automatically configures CXF according to our conventions and registers all spring beans that implement RestService
interface - replacement for https://github.com/oasp/oasp4j/blob/develop/samples/core/src/main/java/io/oasp/gastronomy/restaurant/general/service/impl/config/ServiceConfig.javaRestServiceClientFactory
to oasp4j-rest
with this method:
<T extends RestService> T createClient(Class<T> serviceInterface);
For async support IMHO also
<T extends RestService> T createClientAsync(Class<T> serviceInterface, Consumer<?> consumer);
RestServiceDiscovery
(suggestions for better name welcome) to oasp4j-rest
with this method:
String discoverUrl(Class<? extends RestService> serviceInterface);
or more flexible:
DiscoveryInformation discover(Class<? extends RestService> serviceInterface);
RestServiceClientFactory
that can be used by default and be extended as needed project needs. It will intern use the injected instance of RestServiceDiscovery
. IMHO also the "security/HTTP Header tweaking" stuff should be flexible, expendable and replaceable via some component interface. By default correlation id has to be supported and a solution for passing security token (JWT, OAuth, etc.) should already be contained (via API from opas4j-security
).RestServiceDiscovery
using eureka. WDYT? BTW: To already answer the question "are you proposing to create a framework by OASP?": Yes and no. This is optional stuff and the API (empty marker interface) is so minimal that it IMHO is no framework but the value of doing so is quite high. Without such thing we have many problems unsolved in OASP (e.g. if you extract interfaces from REST-Services then OASP will currently fail because it detects services for registration via JAX-RS annotations in implementation that will then however be in interface, etc.). An empty marker interface does not interfere but solves this elegant. Projects who do not want to couple this way can still copy the entire solution into their own project and have the interface in their own project namespace (that is what is currently happening but preventing reuse and causing problems).
Several comments:
We should decide if we favor contract-first or code-first for microservices. IMO one strong point for microservices is the decoupling of the applications dependencies... and introducing the API as code may cause project to be dependent... of course you can always copy&paste
Do we realy need the marker interface for endpoint registration? Is the code in ´ServiceConfig.java´ on @Bean public Endpoint
still necessary? Because starting an application from the archetype and not having this method... automatically registers all the Rest endpoints
I'm not confortable with another layer of abstraction over client generation... If people chooses to use CXF, they will get better information and understanding without our thin layer.
We should make aware on the documentation the concerns regarding microservices, as you mention on your comment:
Reviewing CXF I came across this feature I didn't knew fail-over wich pointed me to this Apache project I also did not know about polygene and you may find interesting (Composite Oriented Programming for domain centric application development)
@amarinso: Because of the problems with openshift you may ask @KarlPrott. Because of the problems with kubernetes and production line you may ask Tobias N.
Looking at the discussion here, it looks to me that every project has a very different approach. Maybe it is to early to give projects a one-size fits all solution, as we tried with the server side stack. May it would be a good first step to give projects a guidance in the form of:
When to "do" microserivces, when not? What topics need to be addressed including advises for "proven" technologies. Service Discovery Routing Security Logging / Tracing / Monitoring Handling Persistence (e.g. for databases, messaging, ...) Application design principles ...
Maybe some of the topics a covered in the microservices book...
P.S. what could be helpful would be a comparison of different "PaaS" solutions, Swarm, Kubernetes, Openshift. I'm always a bit puzzled when trying to find out what exactly the differences are, and when to choose e.g. Openshift in favor of swarm. At the moment the most obvious point is that openshift offers some additional services (e.g. CI, ...), but is that all?
BTW: If you still consider my proposal to lead to a framework and that should not be part of OASP for some reason then should I contribute to springframework instead of OASP or implement it in mmm?
@hohwille Can you share a more elaborate example from your project to properly evaluate it? maybe I under-valuated from your comment.
We are recommending using standards where appropriate and for REST clients now JAX-RS 2 comes with this support and has some alternative implementations (CXF, Jersey, RestEasy)... what do we miss here?
Maybe we can start listing the "requirements" that we want for our clients, to add to the already mentioned:
Some other Rest Frameworks I've come across include:
Along this thoughts (calling microservices) I highly recommend this blog post from Christian Posta (RedHat)
I already started on my oasp4j fork for a PR on this: https://github.com/hohwille/oasp4j/ Please have a look, get involved and lets work together (not only with words but also with code).
@Inject private MyRestService myRestService
. However this approach can only work when using marker interface as I have to tell spring for which types the factory is responsbile.Along this thoughts (calling microservices) I highly recommend this blog post from Christian Posta (RedHat)
👍
We’re implementing lower-level networking functions at the application layer
I fully agree. So why do we need netflix service discovery in client if docker swarm or kubernetes or mesos can already solve this transparently? Why do we need netflix ribbon client side loadbalancing?
Angel suggested to consider side-car. Here you can find a quick intro: http://blog.christianposta.com/microservices/00-microservices-patterns-with-envoy-proxy-series/
I very much like that you get a solution that focuses on a lot of different aspects that can be configured without the need to put all of that into your code. This makes the solution reusable across all technologies (Java, .NET, JavaScript/Node.js, etc.). However, we would need to do a verification (ideally in a real world project). Also we need to see that this solution really works cross platform easily as it is written in C++ - so if we have a java app that we can deploy to machine X will side-care also work on machine X OOTB or do I have to compile it myself and even end up with gcc errors?
However, instead of building everything into your app this could be a really nice approach to consider.
As @maihacke stated there are a lot of opportunities and so far no single best-practice. My proposal that I have started as a fork is flexible enough to work with all of these opportunities. However, I would love to also crystallize a best-practice to focus on and provide as default implementation.
How do you evaluate Apache Camel in that context? The Enterprise iPaaS team is using this as their approach to Microservices (with Consul as service registry). I have not looked into their details but Google lead me to articles like e.g. https://dzone.com/articles/microservices-with-apache-camel
Currently we are reviewing a PR coming from a real engagement from Carrefour where they have chosen a microservices architecture based on the Netflix stack and running on top of OpenShift.
There are some archetypes for creating infrastructure for microservices as well as some configuration and REST client usage.
There is an obvious overlap between what Spring Cloud provides and what the deployment platform provides, like service discovery, routing or configuration... the same overlap (or similar) will exist with other options like docker Swarm.
We should discuss what will we offer from devon (or OASP)
I'm more in the line of providing utilities/helpers/accelerators that can be used on different scenarios... but that may be insufficient for most of the engagements
Maybe we can propose several alternatives coming from different engagement experiences on the form of documentation (or white books that @ivanderk was proposing)
On my personal opinion we could bet on a platform and favor it on our engagements. In this case I would prefer to rely on OpenShift as the deployment platform because there is already a lot of effort in that project and you have RedHat behind it what gives credibility.
Please share your ideas here so anyone can be aware of our thoughts.