Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas...
Transcript of Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas...
![Page 1: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/1.jpg)
Programação de
Sistemas
Distribuidos
Paulo Gandra de Sousa
Mestrado em Engenharia Informática
DEI/ISEP
![Page 2: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/2.jpg)
Disclaimer
Parts of this presentation are from:
Tannembaum
1
ISEP/IPP
![Page 3: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/3.jpg)
Today’s lesson
Decoupled communication
Message queueing
Enterprise Service Bus
2
ISEP/IPP
![Page 4: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/4.jpg)
DECOUPLED
COMMUNICATION
3
ISEP/IPP
![Page 5: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/5.jpg)
Decoupled communication
What if the receiver is not avaliable?
We need something
Assynchronous and persistent
E.g., voice mail
4
ISEP/IPP
![Page 6: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/6.jpg)
Persistence and Synchronicity in
Communication (1)
Persistent communication of letters back in the days
of the Pony Express.
![Page 7: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/7.jpg)
Persistence and Synchronicity in
Communication (2)
a) Persistent asynchronous communication
b) Persistent synchronous communication
2-22.1
![Page 8: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/8.jpg)
Reliability
Guaranteed delivery in the presence ofnetwork or (receiver) application failures
TCP reliabilibity vs. Reliable Messaging
TCP guarantees that the message iscorrectly delivered if the receiving endpoint is“alive”
Message Queues guarantee delivery even ifthe receiving end is not available withoutextra programming effort
7
ISEP/IPP
![Page 9: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/9.jpg)
General Architecture of a Message-
Queuing System (1)
The relationship between queue-level addressing
and network-level addressing.
![Page 10: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/10.jpg)
General Architecture of a Message-
Queuing System (2)
The general organization of a message-queuing
system with routers.
2-29
![Page 11: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/11.jpg)
Message-Queuing Model
(1)
Four combinations for loosely-coupled communications using
queues.
2-26
![Page 12: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/12.jpg)
Message-Queuing Model
(2)
Basic interface to a queue in a message-queuing
system.
Primitive Meaning
Put Append a message to a specified queue
GetBlock until the specified queue is nonempty, and remove the first message
PollCheck a specified queue for messages, and remove the first. Never block.
NotifyInstall a handler to be called when a message is put into the specified queue.
![Page 13: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/13.jpg)
Decouple even more
Message broker
Delivers, and
Translates message formats
14
ISEP/IPP
![Page 14: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/14.jpg)
Message Brokers
The general organization of a message broker in a message-
queuing system.
2-30
![Page 15: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/15.jpg)
Enterprise Service Bus
(ESB)
Decouple senders and receivers
Promotes construction of applications
from basic functionality blocks
A way to decouple message format from
publishers and subscribers
Can encode business logic in the bus
itself (ex., process choreography)
20
ISEP/IPP
![Page 16: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/16.jpg)
ESB
21
ISEP/IPP
http://blogs.msdn.com/fmarasco/archive/2007/07/17/microsoft-esb-guidance.aspx
![Page 17: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/17.jpg)
ESB
22
ISEP/IPP
http://www.vitria.com/Business_Accelerator/esb.php
![Page 18: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/18.jpg)
ESB sample app: Loan
Broker
23
ISEP/IPPhttp://mule.mulesource.org/display/MULE/LoanBroker+ESB
![Page 19: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/19.jpg)
Exercise
Remember the example DS you provided in the last session.
Would it be natural to use reliable messaging?
Would it be natural to use a decoupled architecture?
What about an ESB?
24
ISEP/IPP
![Page 20: Programação de Sistemas Distribuidospsousa/aulas/PSIDI/PSIDI_5.pdf · Programação de Sistemas Distribuidos Paulo Gandra de Sousa psousa@dei.isep.ipp.pt Mestrado em Engenharia](https://reader034.fdocuments.in/reader034/viewer/2022042223/5ec991bff42e65744a27fa38/html5/thumbnails/20.jpg)
Bibliography
Chapter 2 Tanenbaum
http://en.wikipedia.org/wiki/Loose_coupling
http://en.wikipedia.org/wiki/Message_queue
25
ISEP/IPP