Message-driven

This is also referred to as asynchronous message passing. So, we saw in the Resiliency section that if you could leave a message for the doctor, it may make the system more resilient.

What if all of the patients would only leave messages? Then each doctor could prioritize them or batch-process those messages. For example, printing all recipes together, instead of switching between different tasks.

In addition to loose coupling and isolation, there's also location transparency. You didn't know tha your doctor sent you this prescription while driving home (they snuck out of the window while you left your message). But you don't care since you got what you wanted.

Using messages also allows an interesting option of backpressure. If your doctor receives too many messages, they may collapse from stress. To avoid that, they may text you to say that you'll have to wait a bit longer to receive your prescription. Or, if they have a secretary, we may even ask them to do that anyway. Again, we're talking about delegation here, as all of those principles are correlated. 

Messages are also non-blocking. After you leave the message, you don't sit there waiting for the doctor's response. You usually go back home, to your regular tasks. The ability to perform other tasks while you wait is one of the cornerstones of concurrency.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.249.198