programação de sistemas distribuidospsousa/aulas/psidi/psidi_5.pdf · programação de sistemas...

20
Programação de Sistemas Distribuidos Paulo Gandra de Sousa [email protected] Mestrado em Engenharia Informática DEI/ISEP

Upload: others

Post on 22-May-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

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

Programação de

Sistemas

Distribuidos

Paulo Gandra de Sousa

[email protected]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 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

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

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

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

Bibliography

Chapter 2 Tanenbaum

http://en.wikipedia.org/wiki/Loose_coupling

http://en.wikipedia.org/wiki/Message_queue

25

ISEP/IPP