Session 7: JMS, JCS, JSF
Download
Report
Transcript Session 7: JMS, JCS, JSF
Session 7: JMS, JCA, JSF
Dr. Nipat Jongsawat
หัวข ้อนำเสนอ
• JMS
• JCA
• JSF
: Java Message Service
: Java Connector Architecture
: JavaServer Face
Dr. Nipat Jongsawat
http://ibm.com/redbooks
Patterns: Implementing SelfService in an SOA environment
Dr. Nipat Jongsawat
Messaging
ื่ สำรระหว่ำง applications หรือ
• เป็ นวิธก
ี ำรสอ
software components.
• สง่ เสริม loosely coupled
Application A
Messaging API
Messaging Clients
“MOM”
MessageOriented
Middleware
“e-mail for applications”
Dr. Nipat Jongsawat
Application B
Messaging API
Messaging Clients
Java Message Service (JMS)
• เป็ น Java API เพือ
่ สร ้ำง สง่ รับ และอ่ำน
messages
• Messages
– Asynchronous: a client does not have to
request them in order to receive them.
– Reliable: ensure message is delivered safely
once and only once.
Dr. Nipat Jongsawat
JMS Architecture
• JMS provider
–
a messaging system that implements JMS interfaces and provides
administrative and control features.
• JMS clients
–
programs or components written in Java that produce or consume
messages.
• Messages
–
objects that communicate information between the JMS clients.
JMS client
JMS client
JMS client
JMS
Provider
Dr. Nipat Jongsawat
IBM MQSeries,
Tibco, SpiritSoft,
Fiorano, Softwired
Using JMS API
• A provider wants the components not to
depend on other components’ interfaces, so
that components can be easily replaced.
• The provider wants the application to run
whether or not all components are up and
running simultaneously.
• The application business model allows a
component to send information to another
and to continue to operate without receiving
immediate response.
Dr. Nipat Jongsawat
Messaging Domain
• Point-to-Point (One consumer per message)
• Publish/Subscribe (Many consumers per msg.)
Dr. Nipat Jongsawat
Point-to-Point
• Built around the concept of message queues,
sender and receivers.
• Each message has only one consumer.
• A sender and a receiver of a message have
no timing dependencies. The receiver can
fetch the message whether or not it was
running when the client sent the message.
• The receiver acknowledges the successful
processing of a message.
Dr. Nipat Jongsawat
Publish/Subscribe domain
• Each message can have multiple
consumers.
• Publishers and subscribers have a timing
dependency. A client that subscribes to a
topic can consume only messages
published after the client has created a
subscription, and the subscriber must
continue to be active in order for it to
consume messages.
Dr. Nipat Jongsawat
Message Consumption
•
•
Synchronously: A subscriber or receiver explicitly
fetches the message from the destination by calling the
receive method.
Asynchronous: A client can register a message listener
with a consumer. A message listener is similar to an
event listener. Whenever a message arrives at the
destination, the JMS provider delivers the message by
calling the listener’s onMessage method, which acts on
the content.
Dr. Nipat Jongsawat
Async Messaging (Publisher-Subscriber)
Subscriber
Publisher
Dr. Nipat Jongsawat
http://ibm.com/redbooks
Patterns: Implementing SelfService in an SOA environment
Dr. Nipat Jongsawat
Integration Complexity
AppServer
EIS
EIS
AppServer
JCA
m*n
m+n
Using JCA to access an EIS
is akin to
using JDBC to access a database.
Dr. Nipat Jongsawat
JCA : Java Connector Architecture
• like a bridge, it attaches two ends together,
JavaEE and EIS
• simplifies the integration of diverse EISs
• each EIS requires only one implementation
of CA
Connector
AppServer
Resource
Adapter
Dr. Nipat Jongsawat
EIS
SAP
CICS
...
JCA : Key Components
• Resource Adapter
– Connects EIS resource to the JCA
infrastructure
• System Contract
– Connection & transaction
management and security
• Common Client Interface
– Provides a common programming
interface model for interacting
with EIS via resource adapters
Dr. Nipat Jongsawat
Web services
JMS
JCA
Interface coupling
(abstract service
definition)
YES
Dynamic interface
discovery and
request construction
is possible
NO
Payload agnostic
YES
Technical coupling
(protocol stack)
NO
With WSIF, client is
not bound to a client
library for a particular
protocol
implementation
YES
YES
Portability
YES
Multi-language
NO
Java technology only
NO
Java technology only
Reliability
HTTP-R binding for
SOAP
YES
Specific
www.ibm.com/developerworks/webservices/library/ws-jcajms.html
Dr. Nipat Jongsawat
Web services
JMS
JCA
Transactional Support
Future
WS-Coordination & WSTransaction
Compensation and XA
models
Limited in scope
Only to the queue entry
point
YES
XA model
Security
WS-Security
Not part of the standard,
hence vendor-specific
Integration between EIS
and J2EE
Synchronous mode
YES
Major use
Do it yourself
YES
Asynchronous mode
YES
Document oriented
interface
YES
Future
Event-driven, push mode
YES
Document oriented
interface or flow support
(BPEL4WS)
YES
Future
Dr. Nipat Jongsawat
JSF : JavaServer Face
• Server-side user interface component
framework for Java technology-based web
applications.
• JSP components
– Set of APIs for representing UI components and managing their state,
handling events and input validation, defining page navigation, and
supporting internationalization and accessibility
– A JavaServer Pages (JSP) custom tag library for expressing a JSF
interface within a JSP page
Dr. Nipat Jongsawat
JSF : UI Components
Dr. Nipat Jongsawat
Input Validation
<h:inputText id="string" required="true"
value="#{data.string}" size="20">
<f:validateLength minimum="3"
maximum="12"/>
</h:inputText>
<h:message for="string" style="color: red;"/>
Dr. Nipat Jongsawat
JSF & MVC
Dr. Nipat Jongsawat
Dr. Nipat Jongsawat
More Information
• The J2EE™ 5 Tutorial
• JMS
– http://java.sun.com/products/jms
• JCA
– http://java.sun.com/j2ee/connector
• JSF
– http://java.sun.com/javaee/javaserverfaces
Dr. Nipat Jongsawat