Tải bản đầy đủ (.ppt) (85 trang)

Bài giảng Lập trình mạng Java Message Service - GV. Nguyễn Xuân Vinh

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (790.06 KB, 85 trang )

28/05/151 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
Java Message Service
Presenter: Nguyễn Xuân Vinh
Information Technology Faculty
Nong Lam University
28/05/152 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
2
Content
Understanding The Messaging Paradigm
1
Concepts and Architecture of JMS
2
JMS Messaging Models
3
Anatomy of a JMS Message
4
JMS Features
5
JMS Providers
6
28/05/153 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
3
Understanding The Messaging Paradigm

Some concepts of messaging system

Centralized Architecture


Decentralized Architecture
28/05/154 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
4
Some concepts of messaging system

Messaging systems allow different software applications to
communicate with each other, generically referred to enterprise
messaging systems, or Message-Oriented Middleware

A key concept of enterprise messaging is messages are delivered
asynchronously from one system to others over a network
28/05/155 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
5

Enterprise messaging systems allow two or more
applications to exchange information in the form of
messages

A message is a self-contained package of business data and
network routing headers

In all modern enterprise messaging systems, applications
exchange messages through virtual channels called
destinations.
Some concept of messaging system
28/05/156 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
6


In asynchronous messaging, applications use a simple API to
construct a message, then hand it off to the Message-Oriented
Middleware for delivery to one or more intended recipients.
Some concept of messaging system
Figure 1.1. Message-Oriented Middleware
28/05/157 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
7
Some concept of messaging system

RPC vs Asynchronous Messaging

RPC attempts to mimic the behavior of a system that runs in one
process

A failure on one system has an immediate and debilitating impact
on other systems
28/05/158 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
8

RPC vs Asynchronous Messaging
Business
Application A
RPC
Client/Server
Business
Application D
RPC

Client/Server
Business
Application B
RPC
Client/Server
Business
Application C
RPC
Client/Server
Requires n * (n-1) / 2
connections
Some concept of messaging system
28/05/159 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
9
Some concept of messaging system

RPC vs Asynchronous Messaging

A fundamental concept of MOM is that communication between
applications is intended to be asynchronous

In MOM, each subsystem is decoupled from the other systems
28/05/1510 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
10
Some concept of messaging system

RPC vs Asynchronous Messaging
Centralized message server

(hub and spoke)
JMS
Client
Message
Server
JMS
Client
JMS
Client
JMS
Client
JMS
Client
JMS
Client
JMS
Client
Local "server"
JMS
Client
Local "server"
JMS
Client
Local "server"
JMS
Client
Application A
Local "server"
Application B Application C Application D
Router

Decentralized message
server (IP multicast)
28/05/1511 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
11
Centralized Architecture

A message server is responsible for delivering messages from one
messaging client to other messaging clients

The message server decouples a sending client from other
receiving clients
28/05/1512 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
12

A centralized architecture uses a hub-and-spoke topology

The hub-and-spoke architecture lends itself to a minimal
amount of network connections while still allowing any part
of the system to communicate with any other part of the
system
Centralized Architecture
28/05/1513 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
13
Decentralized Architecture

All decentralized architectures currently use IP multicast at
the network level


Some of the server functionality (persistence, transactions,
security) is embedded as a local part of the client, while
message routing is delegated to the network layer by using
the IP multicast protocol
28/05/1514 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
14

IP multicast allows applications to join one or more IP
multicast groups; each group uses an IP network address that
will redistribute any messages it receives to all members in
its group

The network handles routing automatically
Decentralized Architecture
28/05/1515 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
15
Content
Understanding the Messaging Paradigm
1
Concepts and Architecture of JMS
2
JMS Messaging Models
3
Anatomy of a JMS Message
4
JMS Features
5

JMS Providers
6
28/05/1516 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
16
Concepts and Architecture of JMS

What is JMS?

Architecture of JMS
28/05/1517 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
17
What is JMS?

The JMS (Java Message Service) is an API for enterprise
messaging created by Sun Microsystems

JMS is not a messaging system itself

JMS abstracts access to MOMs
28/05/1518 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
18

Supports message production, distribution, delivery

Supported message delivery semantics

Synchronous or Asynchronous


Transacted

Guaranteed

Durable
What is JMS?
28/05/1519 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
19
Architecture of JMS

JMS architectural components

JMS clients

Non-JMS clients

Messages

JMS provider (Messaging systems)

JNDI administered objects

Destination

ConnectionFactory
28/05/1520 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
20


Architecture of JMS application
Architecture of JMS
28/05/1521 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
21

A JMS Application

JMS Clients

Java programs that send/receive messages

Messages

Administered Objects

Preconfigured JMS objects created by an admin for the use of
clients

ConnectionFactory, Destination (queue or topic)

JMS Provider

Messaging system that implements JMS and administrative
functionality
Architecture of JMS
28/05/1522 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
22


JMS Administration
Architecture of JMS
Administrative
Tool
JNDI Namespace
JMS Client
Bind
Lookup
Logical
Connection
JMS Provider
28/05/1523 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
23
Content
Understanding the Messaging Paradigm
1
Concepts and Architecture of JMS
2
JMS Messaging Models
3
Anatomy of a JMS Message
4
JMS Features
5
JMS Providers
6
28/05/1524 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN

24

JMS provides for two types of messaging models, publish-and-
subscribe and point-to-point queuing
JMS Messaging Models
28/05/1525 85 MÔN: LẬP TRÌNH MẠNG 2 GV: NGUYỄN XUÂN VINH
TRƯỜNG ĐẠI HỌC NÔNG LÂM TP.HCM KHOA CÔNG NGHỆ THÔNG TIN
25

Messaging clients in JMS are called JMS clients

The messaging system - the MOM - is called the JMS provider

A JMS application is a business system composed of many JMS
clients and, generally, one JMS provider

A JMS client that produces a message is called a producer

A JMS client that receives a message is called a consumer
JMS Messaging Models

×