session 7: jms, jca, jsf dr. nipat jongsawat. หัวข้อนำเสนอ jms: java message...
TRANSCRIPT
Session 7: JMS, JCA, JSF
Dr. Nipat Jongsawat
หั�วข้�อนำ�เสนำอ• JMS : Java Message Service• JCA : Java Connector Architecture• JSF : JavaServer Face
Dr. Nipat Jongsawat
http://ibm.com/redbooks Patterns: Implementing Self-
Service in an SOA environment
Dr. Nipat Jongsawat
Messaging
• เป็ นำว�ธี�กรส��อสรระหัว�ง applications หัร�อ software components.
• ส�งเสร�ม loosely coupled
Message-Oriented
Middleware
Application A
Messaging API
Messaging Clients
Application B
Messaging API
Messaging Clients
“MOM”
“e-mail for applications”
Dr. Nipat Jongsawat
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
Provider
JMS
ProviderJMS clientJMS client
JMS clientIBM MQSeries, Tibco, SpiritSoft, Fiorano, Softwired
Dr. Nipat Jongsawat
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
SubscriberXML
Publisher
XML
Async Messaging (Publisher-Subscriber)
Dr. Nipat Jongsawat
http://ibm.com/redbooks Patterns: Implementing Self-
Service in an SOA environment
Dr. Nipat Jongsawat
Integration Complexity
m*n
AppServer
m+n
EIS
JCA
EISAppServer
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 diverseEISs
• each EIS requires only one implementation of CA SAP
CICS...
AppServerResourceAdapter
Connector
EIS
Dr. Nipat Jongsawat
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 ispossible
NO Payload agnostic
YES
Technical coupling (protocol stack)
NO With WSIF, client is
not bound to a client library for a
particular protocolimplementation
YES YES
Portability YES-Multi language
NO Java technology
only
NO Java technology
only
Reliability - HTTP R binding forSOAP
YES Specific
www.ibm.com/developerworks/webservices/library/ws-jcajms.htmlDr. Nipat Jongsawat
Web services JMS JCA
Transactional Support Future- WS Coordination &- WS Transaction
Compensation and XAmodels
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, pushmode
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