1 / 32

EEC-681/781 Distributed Computing Systems

EEC-681/781 Distributed Computing Systems. Lecture 6 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University wenbing@ieee.org. Message-Oriented Communication. Persistence and Synchronicity in Communication Message-oriented transient communication

Download Presentation

EEC-681/781 Distributed Computing Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. EEC-681/781Distributed Computing Systems Lecture 6 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University wenbing@ieee.org

  2. Message-Oriented Communication • Persistence and Synchronicity in Communication • Message-oriented transient communication • Berkeley sockets • Message-passing interface • Message-oriented persistent communication • Message-queuing system • Message brokers (publish/subscribe) • Java message service • A copy of JMS tutorial is available at DCS server /software/activemq/jms-tutorial.pdf EEC-681: Distributed Computing Systems

  3. Synchronous Communication • Client/Server computing is generally based on a model of synchronous communication: • Client and server have to be active at the time of communication • Client issues request and blocks until it receives reply • Server essentially waits only for incoming requests, and subsequently processes them EEC-681: Distributed Computing Systems

  4. Synchronous Communication • Drawbacks of synchronous communication: • Client cannot do any other work while waiting for reply • Failures have to be dealt with immediately (the client is waiting) • In many cases the model is simply not appropriate (mail, news) EEC-681: Distributed Computing Systems

  5. Asynchronous Communication • Message-oriented middleware: Aims at high-level asynchronous communication: • Processes send each other messages, which are queued • Sender need not wait for immediate reply, but can do other things • Middleware often facilitates fault tolerance EEC-681: Distributed Computing Systems

  6. Persistent Communication • Persistent Communication – A message that has been submitted for transmission is stored by the communication system as long as it takes to deliver it to the receiver • E.g. from postal mail to e-mail EEC-681: Distributed Computing Systems

  7. Transient Communication • TransientCommunication – A message is stored by the communication system only as long as the sending and receiving application are executing • All transport-level communication services offer only transient communication • RPC/RMI EEC-681: Distributed Computing Systems

  8. Message-Oriented Transient Communication • Berkeley Sockets • Message-Passing Interface EEC-681: Distributed Computing Systems

  9. Berkeley Sockets EEC-681: Distributed Computing Systems

  10. Berkeley Sockets Connection-oriented communication pattern using sockets EEC-681: Distributed Computing Systems

  11. The Message-Passing Interface (MPI) • MPI is used to do high performance computing on multicomputers • Use high-speed interconnection networks • Come with proprietary communication libraries • Need message-passing primitives at a convenient level of abstraction • Standard APIs, hardware-independent EEC-681: Distributed Computing Systems

  12. Application A Application B Message-Oriented Middleware Messaging API Messaging API Messaging Clients Messaging Clients Message-Oriented Persistent Communication Message-Oriented Middleware (MOM) EEC-681: Distributed Computing Systems

  13. Receiver Sender MOM Messages Characteristics of MOM • Loosely-coupled communication: They offer intermediate storage capacity for messages, without requiring either sender or receiver to be active during message transmission • Encompasses message queuingand publish/subscribe communications EEC-681: Distributed Computing Systems

  14. Producer Queue Consumer send(m1) send(m2) receive() m1 Message Queuing Put message into queue Consume message A message queue offers point-to-point communication: each message produced has one consumer EEC-681: Distributed Computing Systems

  15. Producer Consumer Consumer Publish/Subscribe Broker publish(m1) Pass message to broker send(m1) publish(m2) send(m1) Dispatch message to all consumers send(m2) send(m2) publish(m3) Publish/subscribe offers one-to-many communication: each message published can have many subscribers EEC-681: Distributed Computing Systems

  16. Message Queuing Application EEC-681: Distributed Computing Systems

  17. Publish/Subscribe Application publish(“EEC693”, HW1); publish(“EEC693”, HW2); publish(“EEC681”, Lab1); publish(“EEC681”, Lab2); subscribe (“EEC681”); subscribe (“EEC693”); subscribe (“EEC681”); subscribe (“EEC693”); subscribe (“EEC681”); EEC-681: Distributed Computing Systems

  18. Java Message Service • Standard Java API • Message delivery models • Two messaging models EEC-681: Distributed Computing Systems

  19. JMS Messaging Domains • Publish and subscribe (topic) • Many consumers per message • Point-to-point (queue) • One consumer per message EEC-681: Distributed Computing Systems

  20. JMS Components JMS Client JMS Client Connection Connection Session Session Producer Consumer Message Server Destination Message Message EEC-681: Distributed Computing Systems

  21. Connections and Sessions • A connection connects to a message server • You can create one or more sessions within a connection JMS Client Connection Session Session Session EEC-681: Distributed Computing Systems

  22. Creating Connections and Sessions JMS Client ConnectionFactory create JNDI Store Message Server Connection ConnectionFactories Destinations Session Session Session EEC-681: Distributed Computing Systems

  23. JMS Message Types EEC-681: Distributed Computing Systems

  24. TopicSession QueueSession createStreamMessage( ) createTextMessage( ) TextMessage StreamMessage Creating a Message EEC-681: Distributed Computing Systems

  25. Automatically assigned headers JMSDestination JMSDeliveryMode JMSMessageID JMSTimestamp JMSExpiration JMSRedelivered JMSPriority Developer-assigned headers JMSReplyTo JMSCorrelationID JMSType JMS Message Headers EEC-681: Distributed Computing Systems

  26. Producers, Consumers, and Destinations Producer Consumer Bind to destination Bind to destination Read message Message Server Send message Consume message Destination EEC-681: Distributed Computing Systems

  27. Creating Destinations JMS Client JNDI Store Message Server Topic ConnectionFactories Destinations lookup Queue EEC-681: Distributed Computing Systems

  28. Producing a Message create message Session create Message Destination MessageProducer produce message EEC-681: Distributed Computing Systems

  29. MessageListener onMessage(message) MessageConsumer Message receive() Consuming Messages Incoming messages Asynchronous Message Delivery acknowledge Message Server Incoming messages acknowledge Synchronous Message Delivery EEC-681: Distributed Computing Systems

  30. Filtering with Message Selector Publisher Departments.Sales JMSPriority = 2 Pipeline = 20000 not delivered Subscriber delivered Subscriber Message Server Departments.Sales Pipeline > 20000 Departments.Sales Pipeline > 15000 not delivered delivered Subscriber Subscriber Departments.Sales JMSPriority > 5 Departments.Sales JMSPriority >= 2 AND Pipeline > 10000 EEC-681: Distributed Computing Systems

  31. Browsing a Queue Message1 QueueBrowser Message2 getEnumeration() Message3 Enumeration nextElement() Message4 EEC-681: Distributed Computing Systems

  32. Accessing Message Content get<type>(Name) Message MapMessage TextMessage ObjectMessage StreamMessage BytesMessage getText() getObject() read<type>() EEC-681: Distributed Computing Systems

More Related