microservices

Should an API Gateway Communicate via a Queue or directly to other μServices?

限于喜欢 提交于 2019-12-05 18:40:57
I was wondering which of my two methods is more appropriate, or is there event another one? (1) Direct Direct communication between GATEWAY and μSERVICE A UI sends HTTP request to GATEWAY GATEWAY sends HTTP request to μSERVICE A μSERVICE A returns either SUCCESS or ERROR Event is stored in EVENT STORE and published to QUEUE PROJECTION DATABASE is updated Other μSERVICES might consume event (2) Events Event-based communication via a message queue UI sends HTTP request to GATEWAY GATEWAY published event to QUEUE μSERVICE A consumes event Event is stored in EVENT STORE and published to QUEUE

How to do 2 phase commit between two micro-services(Spring-boot)?

僤鯓⒐⒋嵵緔 提交于 2019-12-05 16:32:20
I Have two mico-serives A and B where they connect to seperate database, From Mico-serives A i need to persist(save) objects of both A and B in same transtation how to achive this. I am using Spring micro-servies with netflix-oss.Please give suggestions on best way to do achive 2 phase commit. you can not implement traditional transaction system in micro-services in a distributed environment. You should you Event Sourcing + CQRS technique and because they are atomic you will gain something like implementing transactions or 2PC in a monolithic system. Other possible way is transaction-log

Should API gateway be responsible for authorisation?

自古美人都是妖i 提交于 2019-12-05 13:32:42
Currently I have a monolith application with Java/Spring Boot the following endpoints: /login /logout /some-resource To access some-resource , the flow is following: The user makes a POST request to /login endpoint. If the credentials are correct, a JWT token is returned in header, otherwise a 401. The users sends the JWT token along with the request to /some-resource . If the token is valid, the resource is returned, otherwise 403. Now I want to split the monolith into 2 services: "AuthServer" and "SomeResourceServer". There will be an API gateway on the top. I am thinking about 2 possible

Design choice for a microservice event-driven architecture

好久不见. 提交于 2019-12-05 13:04:12
Let's suppose we have the following: DDD aggregates A and B, A can reference B. A microservice managing A that exposes the following commands: create A delete A link A to B unlink A from B A microservice managing B that exposes the following commands: create B delete B A successful creation, deletion, link or unlink always results in the emission of a corresponding event by the microservice that performed the action. What is the best way to design an event-driven architecture for these two microservices so that: A and B will always eventually be consistent with each other. By consistency, I

DDD. Shared kernel? Or pure event-driven microservices?

旧巷老猫 提交于 2019-12-05 13:02:44
I'm breaking my system into (at least) two bounded-contexts: study-design and survey-planning. There's a concept named "subject" (potential subject for interviewing) in the study-design context. We also maintain associations between subjects and populations in that domain. Now, in the survey-planning, we also need (some) information about the subject (for example: for planning a visit, or even for anticipated selection of questionnaire, in case the population the subject belongs to is known beforehand). So, I need that "subject" in both contexts. What approach should I pick? Having a shared

Distributed transactions in microservices

淺唱寂寞╮ 提交于 2019-12-05 12:15:59
I have 2 microservices S1 and S2 . S1 invokes S2 to update a data and then S1 inserts another data,But let's consider S1 fails,Then we need to rollback the data updated by S2 or else we'll be in inconsistent state. I also gone through Saga patterns.will it satisfy this inconsistency Can anyone suggest any better solutions for this? Distributed transactions are problematic for most circumstances and they are bad for services Service Boundary – service boundary is a trust boundary. Atomic transactions require holding locks and holding them on behalf of foreign service is opening a security hole

What are the disadvantages of Spring Boot for Java web applications? [closed]

▼魔方 西西 提交于 2019-12-05 09:10:52
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 years ago . [This needs to be voted to be reopened to answer.] Spring boot is tipped as being the default go to when making a new spring application as it makes set up easier and automatically wires in common dependencies. I am yet in industry to see spring-boot used in the manner

Microservice, amqp and service registry / discovery

百般思念 提交于 2019-12-05 08:15:39
I m studying Microservices architecture and I m actually wondering something. I m quite okay with the fact of using (back) service discovery to make request able on REST based microservices. I need to know where's the service (or at least the front of the server cluster) to make requests. So it make sense to be able to discover an ip:port in that case. But I was wondering what could be the aim of using service registry / discovery when dealing with AMQP (based only, without HTTP possible calls) ? I mean, using AMQP is just like "I need that, and I expect somebody to answer me", I dont have to

Rails: How to listen to / pull from service or queue?

喜你入骨 提交于 2019-12-05 07:21:27
Most Rails applications work in a way that they are waiting for requests comming from a client and then do their magic. But if I want to use a Rails application as part of a microservice architecture (for example) with some asychonious communication (Serivce A sends an event into a Kafka or RabbitMQ queue and Service B - my Rails app - is supposed to listen to this queue), how can I tune/start the Rails app to immediately listen to a queue and being triggered by event from there? (Meaning the initial trigger is not comming from a client, but from the App itself.) Thanks for your advice! I just

Why shared libraries between microservices are bad?

北慕城南 提交于 2019-12-05 05:12:01
Sam Newman states in his book Building Microservices The evils of too much coupling between services are far worse than the problems caused by code duplication I just don't understand how the shared code between the services is evil. Does the author mean the service boundaries themselves are poorly designed if a need for a shared library emerges, or does he really mean I should duplicate the code in the case of common business logic dependency? I don't see what that solves. Let's say I have a shared library of entities common to two services. The common domain objects for two services may