Coder Social home page Coder Social logo

Comments (4)

schneidersteve avatar schneidersteve commented on May 16, 2024

Lets imagine that the external service is not available for e.g. 24h. How do you solve this case with synchronous communication?

from banking-kata-java.

TristanoSuriani avatar TristanoSuriani commented on May 16, 2024

Hi Steve,
if the external service is not available for 24h, it is no longer a technical problem. You should better think about why are you communicating with a service that offers so low availability.

Option 0: ignore the problem. Not possible?
So: option 1: do not communicate with this service.
Of course it can be the only possible solution at a certain period of time (but again: a business choice with deep technical consequences).

Option 2: is it possible to ask the team responsible for the service to offer an asynchronous endpoint? Or
Option 3: is it possible to use change data capture to send the data to an event log?

No? Option 4: add caching if it makes any sort of sense.
No? Option 5: pull data to an internally maintained database.

All these options (and better ones I didn't think about) in case we communicate to fetch data, not to write data (in which case I would put a message broker/event log in the middle to prevent loss of data).

There is of course the case where we do not have to be worried about the external service not being available for long time, which is often the case, when you ask your PO to ask the other PO to add asynchronous communication and the answer is "it doesn't fit in the roadmap" so you do need to communicate synchronously.

But more importantly, what is your take on this?

from banking-kata-java.

valentinacupac avatar valentinacupac commented on May 16, 2024

I think it could make sense to have an example of both synchronous communication (request/response) and asynchronous (event-based) to illustrate both. I'm actually thinking of including this as preparation for the next meetup because I wanted to illustrate contract testing, communication with other microservices & third-party systems.

Thanks @TristanoSuriani , "For example, in case of opening a new account, checking that a person exists and is registered in the country." Synchronous implementation is simple there...
@schneidersteve what are your ideas for implementing it asynchronously? (i.e. checking whether person is registered in the country)

from banking-kata-java.

TristanoSuriani avatar TristanoSuriani commented on May 16, 2024

@valentinacupac writing asynchronously from the perspective of the use case is the same as writing it synchronously, as it is abstracted by the port. Changing an existing implementation from synchronous to asynchronous would mean changing only the implementation of the adapter and eventually adding some idempotent key to the entity. Some considerations should be made in deciding where to implement logic for deduplication. Should it be treated as a technical concern? Outside the hexagon. Should it be seen as a functional concern? Inside the hexagon.

Reading asynchronously means waiting for an event that triggers a new use case.

from banking-kata-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.