P1246990956DrYmR - PowerPoint PPT Presentation

1 / 58
About This Presentation
Title:

P1246990956DrYmR

Description:

Sonic Software. 1st J2EE 1.3 Certified MOM! HTTP(S), XML, SOAP, WSDL, JMS, JCA ... Sonic Software. Strong Independent operating company of Progress ... – PowerPoint PPT presentation

Number of Views:40
Avg rating:3.0/5.0
Slides: 59
Provided by: davech
Category:

less

Transcript and Presenter's Notes

Title: P1246990956DrYmR


1
Using Message-Driven Beans in a Service-Oriented
Architecture
Dave Chappell VP Chief Technology Evangelist,
Sonic Software
2
(No Transcript)
3
(No Transcript)
4
(No Transcript)
5
Tell Them About the Book Raffle
6
Sonic Software
Driving Industry Standards
  • 1st J2EE 1.3 Certified MOM!
  • HTTP(S), XML, SOAP, WSDL, JMS, JCA
  • Java Message Service (JMS)
  • Apache Axis
  • Web services, JAXM, J2EE CA
  • XML Schema
  • ebXML
  • WS-I

7
SonicMQ AppServer Integration
  • Borland Appserver
  • HP/Bluestone Total-e-server
  • BEA Weblogic
  • CMT,Clustering, Failover/Reconnect, Design
    Patterns
  • IBM WebSphere
  • Oracle Appserver
  • MacroMedia
  • JBoss (soon)

8
Sonic Software
  • Recognized Enterprise messaging Integration
    middleware
  • Established Over 500 of Global 2000 rely on
    Sonic Software
  • Strong Independent operating company of Progress
    Backing Software Corp. (NASDAQ PRGS) 170M
    cash, no debt Distribution in 65 countries,
    24x7 world-wide support
  • History SonicMQ released 12/1999, 1 JMS
    product Today SonicMQ 4.0, SonicXQ 1.0
    Enterprise Service Bus

9
Agenda
  • J2EE Message Driven Topology
  • JMS Overview
  • Using JMS With EJBs
  • JMS and XA Integration
  • J2EE Connector Architecture
  • Service Oriented Architectures and Web Services

10
J2EE Topology
EJB Containers
Web Containers
JSP
html
Database
EJB
EJB
servlet
xml
EJB
EJB
xml
JSP
EJB
EJB
EIS
servlet
servlet
EJB
EJB
gifs
jpegs
EJB
Presentation Logic
Business Logic
11
J2EE Topology Message Driven
Web Containers
Database
JMS
html
JSP
servlet
servlet
EIS
gifs
jpegs
Presentation Logic
Business Logic
12
J2EE Topology Message Driven
EJB Server
EJB Server
EJB Server
Broker
EJB Server
Broker
EJB Server
Trading Partner
Regional Office
EJB Server
Broker
Broker
EJB Server
EJB Server
Business Partner
13
Agenda
  • J2EE Message Driven Topology
  • JMS Overview
  • Using JMS With EJBs
  • JMS and XA Integration
  • J2EE Connector Architecture
  • Service Oriented Architectures and Web Services

14
Java Message Service (JMS)
  • Sun standard
  • Common APIs
  • Loosely-coupled asynchronous processing
  • Senders and receivers abstractly decoupled from
    each other
  • Destinations administratively configurable at
    runtime
  • Point to Point and Pub/Sub messaging models
  • Supports synchronous or asynchronous communication

15
Java Message Service (JMS)
  • Message delivery semantics
  • Guaranteed Once-and-only-once
  • At-most-once
  • Deployment architecture not addressed by
    specification
  • Vendor differentiators

16
Java Message Service
Messaging Components
BusinessApplication A
BusinessApplication A
JMSProvider
JMS Messaging API
JMS Messaging API
JMS Messaging Client
JMS Messaging Client
standards based API
17
Broad Range of Message Types
MultiPartMessage
Message
BytesMessage
MapMessage
ObjectMessage
StreamMessage
TextMessage
XMLMessage
Included in JMS Specification
Extensions in SonicMQ
18
JMS Messages
19
JMS Reliability
Persistent messages and durable subscriptions
JMSProvider
Publisher
Subscriber
7. publish() method returns
2. Disconnect
Persistent Store
5. Message retained in persistent store
20
JMS Reliability
Transactional Message Send and Receive
JMSProvider
Consumer
Producer
21
JMS Reliability
XA Compliant Transaction Manager
commit()
JMSProvider
Producer
rollback()
External Resource (DB/EJB)
22
Filtering with message selectors
Publisher
Departments.Sales
JMSPriority 2 Pipeline 20000
not delivered
Subscriber
delivered
Subscriber
Message Server
Departments.Sales Pipeline 20000
Departments.Sales Pipeline 15000
not delivered
delivered
Subscriber
Subscriber
Departments.Sales JMSPriority 5
Departments.Sales JMSPriority 2 AND Pipeline
10000
23
JMS as a J2EE Resource
  • 2 Requirements to access a Message Provider
  • ConnectionFactory
  • Creates connection to JMS providers
  • Destination Object
  • The Specific Topic or Queue

24
Obtaining the ConnectionFactory
  • Resource Manager Connection Factories as
    Administered Objects
  • Specify standard mechanism for getting
    connections to resources outside the J2EE
    component
  • Enables the container to do pooling
  • JNDI is used for maximum portability

QueueConnectionFactory qcf (QueueConnectionFacto
ry) ctx.lookup("javacomp/env/jms/TrafficConFactor
y")
25
Accessing the Destination
  • The Specific Queue or Topic
  • Retrieved via JNDI
  • Specified in the Deployment Descriptor
  • Binding to a real Destination done at deploy time

Topic traffic (Topic) ctx.lookup("javacomp/env/
jms/TrafficTopic")
26
What the Java/API looks like
// Create a connection factory TopicConnectionFact
ory factory factory (TopicConnectionFactory)jnd
i.lookup("TopicConnectionFactory") // Create a
connection connect factory.createTopicConnection
(username, password) // Create a
session session connect.createTopicSession(true,
Session.AUTO_ACKNOWLEDGE) // Create a
topics. Topic topic (Topic)jndi.lookup("chat")
27
What the Java/API looks like
// Create Subscriber to application
topics. TopicSubscriber subscriber
session.createSubscriber(topic) // Initialize
the onMessage() message handler. subscriber.setMes
sageListener(this) // Create a
publisher publsher session.createPublisher(null)
// Topic will be set for each reply // Now
setup is complete, start the Connection connect.st
art()
28
What the Java/API looks like
public void onMessage( javax.jms.Message
message) TextMessage textMessage
(TextMessage) message System.out.println(text
Message.getText()) -- OR ... while( true
) textMessage (javax.jms.TextMessage
)qReceiver.receive(1000) ...
29
Break
30
Do the Book Raffle
31
Agenda
  • J2EE Message Driven Topology
  • JMS Overview
  • Using JMS With EJBs
  • JMS and XA Integration
  • J2EE Connector Architecture
  • Service Oriented Architectures and Web Services

32
EJB Design Pattern Reminder
Server provides resource mgmt

create lookup remove
home
context
create lookup remove
client
bean
object
methods
methods
Container
Deployment Descriptor
Automatically invokes services based
on requirements defined in deployment descriptor
Remote interface stubs
33
MessageDrivenBean
EJB Container
EJB Container
PublisherBean
SubscriberMsg-drivenInstance
Delivers
Publishes
Acknowledges
Stores
Database
DurableSubscription
ClientApp
34
MessageDrivenBean
  • Defined in EJB 2.x Specification
  • Benefits
  • Simple to write
  • Allow for asynchronous execution

Container
JMS Provider
Msg-driven Bean Class
Msg-drivenBean instances
Destination
Consumer
35
MessageDrivenBean
  • Executes on receipt of a JMS message
  • javax.jms.MessageListener interface
  • Shares the following characteristics of stateless
    session bean
  • Is stateless and relatively short- lived
  • Security
  • Transactions
  • Concurrency
  • Management
  • All the other services that EJBs enjoy!
  • Notable difference No home or remote interface

36
MessageDrivenBean Interface
  • javax.ejb.MessageDrivenBean
  • ejbCreate(), ejbRemove()
  • setMessageDrivenContext()
  • Just like a usual javax.jms.MessageListner
  • onMessage(javax.jms.Message)

37
MessageDrivenContext
  • get/setRollbackOnly()
  • getUserTransaction()
  • For BMT only
  • Others inherited from EJBContext Interface, but
    not allowed
  • getCallerPrincipal()
  • isCallerInRole()
  • getEJBHome(), getEJBLocalHome()

38
Serialization and Concurrency
  • Container Must Serialize all calls to an MDB
  • ejbCreate(), ejbRemove(), etc
  • No need to be coded as re-entrant
  • Concurrency
  • Container May Launch Multiple Instances of an MDB
  • No guarantee of order
  • Cancellation Message May Arrive Before
    Reservation Message

39
MDB Example
  • public class SubscriberMsgBean implements
    MessageDrivenBean
  • setMessageDrivenContext( MessageDrivenContext
    mdc) ..
  • MessageDrivenContext mdc null
  • public void onMessage( Message inMessage)
  • TextMessage msg (TextMessage) inMessage
  • try
  • catch( Exception e)
  • mdc. setRollbackOnly()

40
MDB Example Deployment Descriptors
  • ...
  • SubscriberMsgBean
  • Container
  • NewsType'Metro/Region
  • javax.jms.Topic
  • durable
  • ...

41
MDB Example Deployment Descriptors
  • QueueMessageDriven
  • 20ool
  • 1-free-pool
  • sonicQueuendi-name
  • com.sun.jndi.fscontext.RefFSContextFactory
  • file//localhost/C/temp/jndi/fileStore/
  • myJMSxaqcf

42
Agenda
  • J2EE Message Driven Topology
  • JMS Overview
  • Using JMS With EJBs
  • JMS and XA Integration
  • J2EE Connector Architecture
  • Service Oriented Architectures and Web Services

43
Distributed Transaction Processing (DTP)
44
A local instance of a DTP system
  • TM
  • JMS Client

RM
RM
45
Local DTP zoom in
EJB
Application Server
JMS Provider
TransactionManager
JMS XA API
XA Resource
SonicMQ Client
JMS Client
46
XA interfaces
  • JMS XA SPI
  • XAConnectionFactory
  • XAConnection
  • XASession
  • XAQueueConnectionFactory
  • XAQueueConnection
  • XAQueueSession
  • XATopicConnectionFactory
  • XATopicConnection
  • XATopicSession

47
Agenda
  • J2EE Message Driven Topology
  • JMS Overview
  • Using JMS With EJBs
  • JMS and XA Integration
  • J2EE Connector Architecture
  • Service Oriented Architectures and Web Services

48
J2EE Directions
  • J2EE 1.3
  • Web Applications
  • Asynchronous
  • JMS
  • MDB
  • EJB 2.0
  • J2EE 1.4
  • SOA Platform
  • Web Services
  • JAX-RPC
  • JSR-109
  • J2EE Connector Architecture
  • EJB 2.1
  • WSEI

49
J2EE Connector Architecture Overview
  • Defines standard for connecting J2EE to
    enterprise information systems (EIS)
  • System contracts define interface specification
    with EIS
  • Connection, Transaction, Security

50
J2EE Connector Architecture Overview
  • Resource adapters
  • Implements the EIS side of the system contracts
  • System-level software drivers for connecting to
    an EIS
  • Enables vendors to create standardized connectors
    to EIS
  • Common client interface
  • Standard API for applications to interact with
    heterogeneous EIS

51
Inbound Communication Model
ResourceAdapter
JMS Destination
WorkMgmt
JMSDisp
EnterpriseJavaBeans
EJBDisp
52
Agenda
  • J2EE Message Driven Topology
  • JMS Overview
  • Using JMS With EJBs
  • JMS and XA Integration
  • J2EE Connector Architecture
  • Service Oriented Architectures and Web Services

53
Service-Oriented Architecture
Global Enterprise
Internet
Web Service
54
Service-Oriented Architectures (SOA)
Architecture for a Distributed World
  • System design methodology using existing
    application components
  • Applications expose functionality through service
    interfaces
  • Loosely-coupled, asynchronous, coarse-grained
  • Distributed across internal networks or the
    Internet
  • Web services
  • Software services built on standards SOAP, WSDL,
    UDDI, XML, HTTP

55
Web Services Technology Stack
56
Web Services Technology Stack
XML-RPC(SOAP-RPC, JAX-RPC)
XML Messaging(SOAP, ebXML,JAXM)
57
Connecting (Web) Services Together
What Else Do You Need?
  • (Web) Services arent Islands of Themselves
  • Network of Cooperative Services
  • Interfaces, Discovery, and Data Formats are only
    part of the big picture
  • Data transformation
  • Intelligent Routing based on content
  • End-to-end guaranteed delivery
  • Management, configuration, and auditing
  • Performance and scalability
  • Asynchronous and synchronous messaging
  • Security
  • Deployment tools

58
Standards Working Together...
Web Client
JAXM/RPC Client
.NET SOAP Client
Apache Client
SOAP/HTTP
SOAP/HTTP
SOAP/HTTP
SOAP/HTTP
Internet
Servlet Container
SOAP/HTTP SOAP/JMS
SOAP/HTTP SOAP/JMS
SOAP/HTTP SOAP/JMS
JMS Messaging Backbone
JCA/EIS
JCA/EIS
EJBContainer
JMS Client
C Client
59
Contact Information
  • Chappell_at_sonicsoftware.com
  • http//www.sonicsoftware.com

Integrate with Ease. Extend at WillTM.
Write a Comment
User Comments (0)
About PowerShow.com