microservice-architecture | Microservice Architecture Pattern using Spring | Microservice library

 by   sherxon Java Version: Current License: MIT

kandi X-RAY | microservice-architecture Summary

kandi X-RAY | microservice-architecture Summary

microservice-architecture is a Java library typically used in Manufacturing, Utilities, Automotive, Architecture, Microservice, Spring Boot, Spring, Docker applications. microservice-architecture has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has low support. You can download it from GitHub.

All micro services are spring boot applications with dependencies managed by maven. Each Service has bootstrap.yml file which stores minimum required configuration for each service. I have added all above mentioned micro services into one parent project just to make it easy to manage in one place as it is just a POC project, without much business logic abd heavy requirements. You can still run each micro service independently. This is Config First Bootstrap, so you should run Config Server first and Eureka Server second then Api Gateway and other micro services. You may see runtime exceptions thrown by Config Server when you run it until Eureka Server runs and Config server register itself.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              microservice-architecture has a low active ecosystem.
              It has 27 star(s) with 8 fork(s). There are 1 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              microservice-architecture has no issues reported. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of microservice-architecture is current.

            kandi-Quality Quality

              microservice-architecture has 0 bugs and 0 code smells.

            kandi-Security Security

              microservice-architecture has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              microservice-architecture code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              microservice-architecture is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              microservice-architecture releases are not available. You will need to build from source code and install.
              Build file is available. You can build the component from source.
              microservice-architecture saves you 71 person hours of effort in developing the same functionality from scratch.
              It has 185 lines of code, 4 functions and 7 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed microservice-architecture and discovered the below as its top functions. This is intended to give you an instant insight into microservice-architecture implemented functionality, and help decide if they suit your requirements.
            • Main application
            • Entry point for the application
            • Starts the eureka application
            Get all kandi verified functions for this library.

            microservice-architecture Key Features

            No Key Features are available at this moment for microservice-architecture.

            microservice-architecture Examples and Code Snippets

            No Code Snippets are available at this moment for microservice-architecture.

            Community Discussions

            QUESTION

            Data replication or API Gateway Aggregation: which one to choose using microservices?
            Asked 2021-May-10 at 18:01

            As an example, let's say that I'm building a simple social network. I currently have two services:

            • Identity, managing the users, their personal data (e-mail, password hashes, etc.) and their public profiles (username) and authentication
            • Social, managing the users' posts, their friends and their feed

            The Identity service can give the public profile of an user using its API at /api/users/{id}:

            ...

            ANSWER

            Answered 2021-May-10 at 18:01

            In general, I strongly favor state replication via events in durable log-structured storage over services making synchronous (in the logical sense, even if executed in a non-blocking fashion) queries.

            Note that all systems are, at a sufficiently high level, eventually consistent: because we don't stop the world to allow an update to a service to happen, there's always a delay from update to visibility elsewhere (including in a user's mind).

            In general, if you lose your datastores, things get ruined. However, logs of immutable events give you active-passive replication for nearly free (you have a consumer of that log which replicates events to another datacenter): in a disaster you can make the passive side active.

            If you need more events than you are already publishing, you just add a log. You can seed the log with a backfilled dump of synthesized events from the state before the log existed (e.g. dump out all the current ProfilePictures).

            When you think of your event bus as a replicated log (e.g. by implementing it using Kafka), consumption of an event doesn't prevent arbitrarily many other consumers from coming along later (it's just incrementing your read-position in the log). So that allows for other consumers to come along and consume the log for doing their own remix. One of those consumers could be simply replicating the log to another datacenter (enabling that active-passive).

            Note that once you allow services to maintain their own views of the important bits of data from other services, you are in practice doing Command Query Responsibility Segregation (CQRS); it's thus a good idea to familiarize yourself with CQRS patterns.

            Source https://stackoverflow.com/questions/67462723

            QUESTION

            Spring boot error: Spring table doesn't exist
            Asked 2021-Feb-08 at 06:31

            when I'm trying to save roles in the database, the "springit.role table doesn't exist" occur.

            I'm not creating a table with name "role" in my database because the teacher in the course which I'm learning now didn't create one.

            The exception shown when I call the "addUsersAndRoles()" in the DatabaseLoader class method

            So, what is the problem?

            Role.java

            ...

            ANSWER

            Answered 2021-Feb-08 at 06:31

            For sure you are going to need that table, either created by yourself or by Hibernate.

            There is a config which you can add to spring boot apps using JPA in order to automatically generate the database schema (or the parts that are missing). Take a look here https://docs.spring.io/spring-boot/docs/1.1.0.M1/reference/html/howto-database-initialization.html

            Source https://stackoverflow.com/questions/66096252

            QUESTION

            Remember me with OAuth2 in SPA
            Asked 2019-Sep-11 at 08:02

            I know the concept of OAuth2 and OpenID. in our application authentication is happening through OKTA and we receive access-token in a response. Our architecture is a microservice-architecture and we are using EmberJS at frontend.
            we have to implement remember-me functionality it will keep the user logged in for the next 30 days. I did some study on it and came to points that will satisfy my requirements.

            1. keep user session active for 30 days in OKTA.
            2. refresh access token periodically based on its expiry time.

            How this refreshing will work if browser is closed? Let's say a user is logged in and closed the browser then reopened it after 3 days.

            ...

            ANSWER

            Answered 2019-Sep-11 at 08:02

            With respective to OAuth 2.0 best practices, it is recommended to have short lived access tokens. There is a dedicated RFC definition such best practices which is identified by RFC6819 - OAuth 2.0 Threat Model and Security Considerations. There are several sections which emphasise on using short lived access tokens .For example here you can see why it is recommended.

            With this perspective, you may handle this situation using browser cookies. Cookies are the mechanism which helps browser and server to maintain states. In a typical web application, login state can be maintained through cookies. There are two variants of cookies.

            1. Session cookie
            2. Persisted cookie

            The second cookie type, persisted cookies do not go out of browser when browser is closed. Of course user can clear cookies to remove them. In your scenario, you can set such a cookie to user with desired lifetime. In the backend, you need to map cookie value to a state, which should start when backend receive a valid access token/ ID Token (after authentication and authorization step).

            About cookies security, there are many things you must concentrate on. But the most important are setting cookie to be secure and HttpOnly.

            Also, you may store a reference to refresh token in backend correlating to the cookie. Then for each fresh usage you can use refresh token to obtain access token if you require for example API access with access token.

            Source https://stackoverflow.com/questions/57751596

            QUESTION

            What is the difference between Microservices and Monolythical approach for the provided use-case
            Asked 2018-Dec-02 at 03:42

            So I started reading some things about different software architectures and inevitably came across Microservices Architecture. Yet, I am wondering about the way these achitectures differ from each other. In a monolythical approach I would e.g. modify a POM.XML to take my different layers and pack them into one application to deploy it. I'd say this might even be the most common way to set up a simple application.

            Now as I understood Microservices, you seperate each service from each other and let them run independently. For me that means, that every service is deployed on its own (so you basically got a tomcat running with quite a lot of .war-files on it. But I think I miss the difference to a monolythical application.

            I am going to try to set an (quite common) example:

            You got a frontend (e.g. Angular) with a Spring-Boot Backend communicating via REST-Services. Now I take a POM.XML and do the following steps:

            • build the Frontend-Application
            • include the necessary JS-files into my Spring-Application
            • create WAR-file from the project

            As a result I got one single WAR-file that I can deploy but got two Services included: Backend and Frontend. Yet, I would call it a monolythical approach.

            Now when I would include the Angular-Application into my tomcat and deploy a WAR-file of my Spring-Boot part of the application (without integrated frontend). That way I would have two deployed services running on the same server interacting with each other that can be replaced without touching each other. By definition I would not call it a monolythical approach (same code, different deployment) but a Microservice-architecture, right? But this can not be the case since literally every article I read told me the same advantages and disadvantages for architectures and I cannot see any difference except for the possibility to exchange frontend and backend (which I have in both cases, yet in one I would need to redeploy the full application in the first case).

            ...

            ANSWER

            Answered 2018-Dec-01 at 13:16

            Microservices are set just set of guide lines that talk about how to design your application so that it is scalable, manageable and adapts to fast development pace. It is not just about how you are deploying your application.

            Over the years, we have learned that when you try build one big application as monolith, initially it gives you pace, different modules in your monolith has complete visibility of each other and can access things, tweak things around as they wish, even one change that should affect one module may migrate into other classes, where it should not have been. While it helps you prototype, but code becomes less and less maintainable. You can ofcourse put in effort to make sure your code remains clean, but that effort grows as app grows.

            Also you as developer are required to know whole product and it is difficult to work in silo, without worrying about the whole architecture, which makes it difficult for new people to join and make changes.

            Next when you deploy, specially now a day, scale is important, and you need to adapt to traffic. All your modules will not expect high traffic 24/7. But if you have monolith, even if one module is being used by 100 of users your application have to scale for 100 of users.

            Microservices just pulls in info from this, and defines some guidelines

            1. You should breakdown your app based on biz domains. Every service is responsible for one aspect only. They talk to other via contract (API or events) and as long as contract stands you can do what you want within your service. New dev need to learn just one service to start with.

            2. Scaling becomes easy, because if you have load on one service only that will scale. Other modules deployed independently can scale as the load specific to them.

            3. By keeping it small you can build fast, make changes in rapid way. No shared database make sure that you take a call on what you want to save, how you want to save and how you want to change.

            For you case, just deploy it the way you think its best. But if you start to grow, you have some 50 odd services (or that size project) you will see benefits of divide and conquer.

            Source https://stackoverflow.com/questions/53570777

            QUESTION

            How to manage microservices that are live
            Asked 2018-Aug-19 at 08:54

            I have been testing out microservices lately using springboot to create microservice projects. The more i understand about the setup the more questions i am confronted with.

            1. How are all the microservices that are running, managed? How do developers manage, deploy or update microservices via a central location?
            2. When deploying multiple instances of a microservice, do you leave the port to be decided during runtime, or should it be predefined?

            I am sure there will be much more questions popping up later. Links used:

            Thanks in advance.

            ...

            ANSWER

            Answered 2018-Aug-18 at 19:19

            you can start with the following:

            Monitoring :

            Source https://stackoverflow.com/questions/51911797

            QUESTION

            Azure Logic Apps - HTTP communication between microservices
            Asked 2018-Feb-17 at 12:57

            Are Logic Apps considered microservices? If so, is making HTTP API calls from Logic Apps, whether it's using HTTP/Function/APIM connectors, not a violation of direct HTTP communication between microservices?

            If possible, never depend on synchronous communication (request/response) between multiple microservices, not even for queries. The goal of each microservice is to be autonomous and available to the client consumer, even if the other services that are part of the end-to-end application are down or unhealthy. If you think you need to make a call from one microservice to other microservices (like performing an HTTP request for a data query) in order to be able to provide a response to a client application, you have an architecture that will not be resilient when some microservices fail.

            Moreover, having HTTP dependencies between microservices, like when creating long request/response cycles with HTTP request chains, as shown in the first part of the Figure 4-15, not only makes your microservices not autonomous but also their performance is impacted as soon as one of the services in that chain is not performing well.

            Source: https://docs.microsoft.com/en-us/dotnet/standard/microservices-architecture/architect-microservice-container-applications/communication-in-microservice-architecture

            ...

            ANSWER

            Answered 2018-Feb-17 at 12:57

            Yes, Logic Apps are primarily Http based services. Whether or not it's 'micro' really doesn't matter because 'micro' is too abstract to have any real meaning. It was a useful marketing term at one point but it's tour on the tech fashion runway has ended. So, don't even think about that. ;)

            What the authors are trying to express is that you should avoid chaining dependencies in an app's architecture. A waits for B which waits for C which waits for D which waits for E, etc... That's the first line in the graphic.

            Instead, Basket can check Catalog on it's own, then call Ordering, while Inventory is checked in the background. You only one level deep instead of 4.

            Source https://stackoverflow.com/questions/48836908

            QUESTION

            Nats which pattern to use
            Asked 2017-Jun-12 at 16:13

            I asked a question in: Microservice Architecture dependency which pattern to use when using a clustered Microservice architecure.

            I recieved answer that point to point should work but when reading: https://nats.io/documentation/concepts/nats-req-rep/ It feels like all subscribers recieves event (and because of that handles it) but there will just be one subscriber that responses. This will not work when putting an order event that will trigger an update-inventory-event that Inventory microservices subscribes to (as in example in link) i.e it wont work in a clustered env due to inventory will be updated the same amount of times as the amount of microservice instances.

            How can I solve this scenario using Nats?

            Thanks in advance!

            ...

            ANSWER

            Answered 2017-Jun-12 at 16:13

            NATS.io supports this feature using queue groups:

            All subscriptions with the same queue name will form a queue group. Each message will be delivered to only one subscriber per queue group, using queuing semantics. You can have as many queue groups as you wish. Normal subscribers will continue to work as expected.

            Connect your services using the queue group (sample is node.js):

            https://github.com/nats-io/node-nats#queue-groups

            Source https://stackoverflow.com/questions/44487463

            QUESTION

            Hypermedia response in a microservice architecture
            Asked 2017-Feb-26 at 00:02

            I've started the journey of learning more about this architecture using Spring Cloud and the Netflix's projects.

            From a general standpoint, I do understand the architecture but now that I'm actually coding an app, a horizon of doubts has appeared about some minimal stuff that could have a big impact in the big approach of this architecture.

            First, my app is based on this tutorial which I assume as valid since it's from Spring itself: https://spring.io/blog/2015/07/14/microservices-with-spring

            And now, the problem: (ALL THIS USES EUREKA) let's say I've a microservice "accounts" which consist only in Spring Data REST for the persistence/HATEOAS and on top of that I've a client service which consumes those endpoints using RestTemplate (because I'm using Ribbon's load balancer). From my view, this is how it works: user -> frontend -> client service -> Spring Data REST endpoints (the microservice) -> DB.

            This is nice and all but when I get the endpoint response (from the RestTemplate), it contains hypermedia going directly to the microservice, and per se, you now can drive your way through the microservice while ignoring the load balancer, which, for me, kills the purpose of it. And if I've like 5 microservices scaling to each other, it means the user is now focusing into just one of a broad way of 5 microservice that are supposedly managed by load balancer.

            Q1: Is ok for an user to have that knowledge of the API (and then kinda killing part of the structure)?

            Even if I add the links to the services detected by Eureka and delete the current endpoints to that microservice, those links aren't going to work and such means I'm chopping of the hypermedia links.

            Q2: Is there another approach to this? Through some kind of proxy, external load balancer, dns or something like that?

            P.D: I don't know if I'm being clear enough. Please let me know if something is misty.

            P.D.2: Summary question: what to do with those media links? Let them be or use something else (please tell) to actually get them "right"?

            Edit: Based on the advices below, I added Zuul which seems to be the solution to my problem. Now, about Zuul, where should I use to filter?

            My app is like this right now: account-microservice (Spring Data REST) and account-web-service (client with the RestTemplate Load balancer). Those are the Eureka registered names.

            Where must go the @EnabledZuulProxy? Inside the microservice or inside the client?

            My current config is this one (currently, the @EnabledZuulProxy is in the client):

            My microservice:

            ...

            ANSWER

            Answered 2017-Feb-24 at 16:28

            If you use Zuul from Spring Cloud Netflix as your load balancer it will automatically add the X-Forwarded-Host header which Spring HATEOAS will respect. When that header is present HATEOAS will generate links using the host value in the header. If you are not using Zuul than you will have to configure your load balancer to add that header.

            Source https://stackoverflow.com/questions/42428045

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install microservice-architecture

            You can download it from GitHub.
            You can use microservice-architecture like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the microservice-architecture component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/sherxon/microservice-architecture.git

          • CLI

            gh repo clone sherxon/microservice-architecture

          • sshUrl

            git@github.com:sherxon/microservice-architecture.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link