Presentation is loading. Please wait.

Presentation is loading. Please wait.

EEC-681/781 Distributed Computing Systems Lecture 6 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University

Similar presentations


Presentation on theme: "EEC-681/781 Distributed Computing Systems Lecture 6 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University"— Presentation transcript:

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

2 2 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao 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

3 3 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao 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

4 4 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao 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)

5 5 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao 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

6 6 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao 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

7 7 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Transient Communication Transient Communication – 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

8 8 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Message-Oriented Transient Communication Berkeley Sockets Message-Passing Interface

9 9 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Berkeley Sockets PrimitiveMeaning SocketCreate a new communication endpoint BindAttach a local address to a socket ListenAnnounce willingness to accept connections AcceptBlock caller until a connection request arrives ConnectActively attempt to establish a connection SendSend some data over the connection ReceiveReceive some data over the connection CloseRelease the connection

10 10 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Berkeley Sockets Connection-oriented communication pattern using sockets

11 11 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao 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

12 12 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Message-Oriented Persistent Communication Message- Oriented Middleware Application A Messaging API Messaging Clients Application B Messaging API Messaging Clients Message-Oriented Middleware (MOM)

13 13 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao 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 queuing and publish/subscribe communications Sender Receiver MOM Messages

14 14 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Message Queuing ProducerQueueConsumer send(m1) send(m2) receive() m1 Put message into queue Consume message A message queue offers point-to-point communication: each message produced has one consumer

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

16 16 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Message Queuing Application

17 17 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Publish/Subscribe Application subscribe (“EEC681”); subscribe (“EEC693”); subscribe (“EEC681”); subscribe (“EEC693”); publish(“EEC681”, Lab1); publish(“EEC681”, Lab2); publish(“EEC693”, HW1); publish(“EEC693”, HW2);

18 18 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Java Message Service Standard Java API Message delivery models Two messaging models

19 19 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao JMS Messaging Domains Publish and subscribe (topic) –Many consumers per message Point-to-point (queue) –One consumer per message

20 20 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao JMS Components Message Server Message Destination JMS Client Connection Session Producer JMS Client Connection Session Consumer

21 21 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Connections and Sessions A connection connects to a message server You can create one or more sessions within a connection JMS Client Connection Session

22 22 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Creating Connections and Sessions Message Server JNDI Store JMS Client Connection Session ConnectionFactory create ConnectionFactories Destinations

23 23 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao JMS Message Types Message typeMessage body MessageNo body TextMessageA standard Java string ObjectMessageA serializable Java object MapMessage A set of name/value pairs where values are Java primitives StreamMessageA stream of Java primitives BytesMessageA stream of uninterpreted bytes

24 24 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Creating a Message createStreamMessage( ) StreamMessage TopicSession createTextMessage( ) TextMessage QueueSession

25 25 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao JMS Message Headers Automatically assigned headers –JMSDestination –JMSDeliveryMode –JMSMessageID –JMSTimestamp –JMSExpiration –JMSRedelivered –JMSPriority Developer-assigned headers –JMSReplyTo –JMSCorrelationID –JMSType

26 26 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Producers, Consumers, and Destinations Message Server Send message Consume message Destination Producer Bind to destination Consumer Read message Bind to destination

27 27 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Creating Destinations Message Server JNDI Store JMS Client Topic Queue ConnectionFactories Destinations lookup

28 28 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Producing a Message create message produce message Session MessageProducer MessageDestination create

29 29 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Consuming Messages Incoming messages MessageListener onMessage(message) Message Server acknowledge MessageConsumer Message receive() Incoming messages acknowledge Asynchronous Message Delivery Synchronous Message Delivery

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

31 31 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Browsing a Queue nextElement() QueueBrowser getEnumeration() Message 1 Message 2 Message 3 Message 4 Enumeration

32 32 Fall Semester 2008EEC-681: Distributed Computing SystemsWenbing Zhao Accessing Message Content Message TextMessageMapMessageObjectMessageStreamMessageBytesMessage getText()getObject() get (Name) read ()


Download ppt "EEC-681/781 Distributed Computing Systems Lecture 6 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University"

Similar presentations


Ads by Google