Star

Distributed System-Indirect Communication and Naming

CMU-95702分布式系统 第6、9章总结笔记

  • Indirect Messaging: Indirect communication is defined as communication between entities in a distributed system through an intermediary with no direct coupling between the sender and the receiver(s).

    • Decoupled in space:
      • Sender does not need to know the identify of the receiver(s) and visa-versa
      • Good for handling legacy systems – Decoupled in time:
      • A component need not even be running
      • The messaging system can store messages until they are successfully delivered
      • Reliable delivery is insured
  • Two messaging modes:

    • Point-to-point:
      • Inventory to Factory
      • Inventory to Sales
      • Factory to Accounting
    • publish / subscribe :
      • parts to parts inventory and parts order
  • some example scenarios:

    • asynchronous communication: like chat ant twitter type app, report info to on or more interested systems
    • event-driven problem
    • decoupled/ multiple consumers
    • multiply interested parties
  • indirect messaging protocols:

    • two open standars: XMPP & amqp
  • Java's JMS API:

    • An API for performing indirect messaging.
    • It is an abstraction API like JNDI and JDBC.
    • Interacts with some Message Oriented Middleware (MOM)
    • JMS is a client-facing interface, meant to abstract way the particulars of any MOM.
    • In theory, you should have portability of systems written with JMS such that they can work with any MOM.
    • API is javax.jms
  • JMS Queues and topics

  • JMS message types:

    • Stream
      • Sequential stream of Java primitive data types.
    • Map
      • Set of name-value pairs
    • Names are String objects
    • Values are Java primitives (including String)
    • Text
      • Message is a String object
    • Plain-text message
    • XML messages
    • Object
      • Serialized Java object
    • Simple if in Java-only environment
    • Bytes
      • Stream of un-interpreted bytes.
      • To encode a message body to match an existing message format
  • Message driven beans: components that are executedasynchronously by messages coming available in a Queue or Topic.

Line Question on class:

  • abstract indirect messaging API: JMS
  • point-to-point messaging: Queue
  • mom used in lab: Glassfish
  • public subscribe message: Topics
  • Indirect Messaging Destination: Queue and Topics
  • Administratively managed resources (External to your program): Connectionfactory, Queue, Topics