-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create api modules for each core system #210
Comments
We have discussed this idea within AITIA. The pacakage But here are some concerns for further discussion: (1) The current client-library was made with the intention of being as user friendly as possible. Bringing a ProxyFactory into, would make things more complicated and less understandable. (2) The current client-library offers such methods which are dealing with more core-service in one call, which are also quite handy for the users. But if you can't be sure that all the necessary interface are implemented, then you can't provide such useful methods. (3) With this kind of InvocationHandler the possible error response probably would be hidden somwhere under some kind of (4) We don't see how an (5) If we are right
(+1) Tomcat isn't loading the application classes with SystemClassLoader to allow more Web-Application runing in different containers within the server. So the example code probably need to be corrected here. |
Hello @borditamas, Sorry, I could have made the example more clear.
You can put in any concrete Type. All rules regarding java interfaces apply. Its super handy!
I am not sure if I understand you correctly. The API interfaces I have in mind would be created by the developers of each core system. They surely know if a method is implemented or not.
Again, all rules of a java interface apply. If the method has a checked exception, you can throw that exception from the
Well, it doesn't. You create a
We are using Spring IoC and Spring Data. We are using proxies all the time already. For example all classes which have I found a very old article from Spring themselves on this topic: https://spring.io/blog/2007/07/19/debunking-myths-proxies-impact-performance/ |
Hello,
If you mean the way that you've used Object type in this example code only, and the real implementation would be with concrete type like "SystemRequestDTO" then it's OK. But if you mean that in the real implementation the methods could be called with any type of input, then we think it's problematic.
Also not sure we are on the same understanding :). So we think, that you suggest to have each core/support system an own module which contains only it's own DTO classes, an interface class with the service methods, one (or more in the future) InvocationHandler class and a ProxyFactory class. This kind of package would be also published (one per core/support system) and client developers should decide which one they need to install for their application system. And this is the point where we see some disadventage.
You are right.
Understand.
That's true, but we're using them mostly on server side and (accoring to our understanding) your suggestion would have effect on client side. The topic of "what counts as significant performance overhead" is really depending on the actual case. In AH community you can meet again with various opinions and requirements. Don't know how much time you have, but if you mind youd could do a real implementation of your idea in DeviceRegistry. That way we could discuss all aspects really in detailed. |
Hello,
It would be like this (as mentioned with similar annotations):
The
Yes.
I don't disagree on that. They could be included in the "common-api" since that would be useful anyway.
No, the client developers do not need to implement the interfaces. That is the point. Just like we don't need to implement the interfaces of our SQL Repositories. The implementation is done dynamically through the InvocationHandler. IMHO, the implementation should deal with the lookup and the query. Also the InvocationHandler is only written once and it would be able to deal with all interfaces as long as the mandatory annotations are provided.
I am not sure what you mean. In the Onboarding-Controller for example I need the AuthorizationService, OrchestrationService and CertificateAuthority. Having the mandatory core systems in a "common-api" module, I would only need to declare "certificate-authority-api" as my dependency and the "common-api" pulls it transitively.
In the end, clients can choose which approach they would like to choose. I am not saying we should get rid of the existing I have to admit my main focus is support systems which run on sufficient hardware and to maximize re-usability. If you all dislike the idea of proxies, we could also make concrete classes for the api-modules, just like I did for the onboarding process in the I can probably implement an example which uses POST and reuses the existing HttpService. kind regards, |
Hello,
Okay now it's much more clear and this explains why we are not on the same understanding regaring to point (2). We absolutely understand that "... the client developers do not need to implement the interfaces." What we are trying to pointed out is on top of that. Due to "shared DTOs" (-> Anyway, now it's clear that your conception would be managable without any impact on the client library. I think that we should keep on discuss about aspects like:
|
Hello,
Yes, we should use almost any means to make development faster for us and our clients. In case there is a real need for performance, we can troubleshoot the bottlenecks and tweak wherever its needed.
That is a good question.
I implemented an example of JDK Proxies under https://github.com/mzsilak/core-java-spring/tree/common-api. I think the implemented HttpInvocationHandler supports already a majority of existing systems, but testing is needed. It is written for HTTP(s) with JSON. As a side note, I used The creation of the common-api module (moving classes from In this prototype implementation I omitted the mentioned ProxyFactory. I think some kind of Builder is better suited if we want to support more kinds of InvocationHandlers in the future. The deviceregistry-api has a main method in the test folder. It requires the core services running on localhost and presents 3 different errors / results.
I understand. I can imagine that the common-api is enough as dependency and that other api-modules are added as the client library evolves. |
Hello @borditamas, I experimented with JMH benchmarks and compared Following the results:
JMH and Java versions:
The results for I did not profile any of the implementations, but just created the benchmark tests and run them. |
Hello,
100% agree. After all, having an interface module per systems, we see as a good idea for the development of supporting systems.
Yes we should do that, and lot of thanks for the benchmark. |
Let's lift this in the Roadmap session in the Vaccine WS, Wednesday April 14. |
Currently all shared DTOs exist in the core-common project. With time it grows to a considerable size.
I would rather create a module for each core system which includes its models/DTOs and an interface for each service the system exposes.
The interface itself could be enriched with annotations to allow proxying to a transport.
This moves the effort to use a core service from each client to the service provider. Once the interface is written and annotated, all clients can use it.
See following example where I reused the bind parameters of spring controllers. (I guess our own annotations would be better here):
This would be the invocation handler which parses all annotations, makes a lookup in context/orchestration/serviceregistry and finally makes the query. If we are smart enough we could design protocol independent annotations be ready for future transports.
Creating and using the actual proxy is quite easy.
Somewhere else in the code...
What do you think?
The text was updated successfully, but these errors were encountered: