48
1 The J2EE Platform Connector Architecture 1.0 Rahul Sharma Senior Staff Engineer Sun Microsystems, Inc.

The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

  • Upload
    halien

  • View
    238

  • Download
    4

Embed Size (px)

Citation preview

Page 1: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

1

The J2EE™ Platform ConnectorArchitecture 1.0

Rahul SharmaSenior Staff EngineerSun Microsystems, Inc.

Page 2: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

2

Agenda

• Overview• Technical details of Connector

Architecture• Status and roadmap• Q&A

Page 3: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

3

Enterprise Applications

Clients

Middle Tiers

EIS TierDBMSs ERP

Systems

EnterpriseServices

Device

D D D

Page 4: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

4

EIS Integration

• Key issues in EIS integration– Heterogeneous and complex EISs– Ease of integration and application

development– Tools– Transactions and security– Scalability

• Connector Architecture addresses this under the scope of the J2EE 1.3 platform

Page 5: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

5

J2EE™ Platform

• The J2EE platform provides:– Faster solution delivery time to market– Re-usable components– Write Once, Run Anywhere™

– Huge Industry Support• Connector architecture adds:

– Easy EIS connectivity– Enterprise Application Integration

Page 6: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

6

Connector Architecture

• Standard architecture for EIS integration • Targeted EISs under 1.0:

– ERP systems– Mainframe transaction processing systems– Non-Java legacy applications– Database systems

• Defined through the Java Community ProcessSM initiative

Page 7: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

7

ConnectionPooling

TransactionManager

SecurityManager

Transaction Management

Connection Management

Security Management

System Contracts

Enterprise Information System

ResourceAdapter

J2EEApplication Server

ApplicationComponent

High Level Architecture

Application Contract

EIS-specificinterface

Container-ComponentContract

Page 8: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

8

Value Proposition

• Reduces scope from m x n to m + n

• Simplifies application development• Provides scalable, secure and

transactional integration

Application Servers

ApplicationServer

EIS

EISs

Page 9: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

9

System Contracts

• System Contracts specified in 1.0:– Connection management– Transaction management– Security management

• Proposed enhancements inlater versions:– Thread management– JMS pluggability

Page 10: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

10

ConnectionManagement Contract• Supports connection management

– Connection pooling– Configuration of connection factory– Creation of connection– Matching of pooled connections

• Enables application server to provide Quality of Services (QoS)

Page 11: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

11

Transaction Management

• Local Transaction– Managed internally by an EIS

resource manager• XA Transaction

– Spans across multiple EISresource managers

– Requires transaction coordination by an external Transaction Manager

∀ Two-phase commit (2PC)∀ One-phase commit (1PC) optimization

Page 12: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

12

TransactionManagement Contract∀ Resource Manager (RM) can be:

Non-transactionalLocal transaction onlyLocal and XA transaction

∀ Resource Adapter implements:– LocalTransaction interface– JTA XAResource interface

• Application server required to support all three transaction levels

Page 13: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

13

Security Management

• Extends the J2EE platform security model for secure EIS connectivity

• Security mechanism and technology independent:– Basic user-password mechanism– Kerberos v5– EIS specific security mechanism

Page 14: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

14

ConnectionPooling

TransactionManager

SecurityManager

System Contracts

Enterprise Information System

ResourceAdapter

J2EEApplication Server

ApplicationComponent

Common Client Interface

Application Contract

EIS-specificinterface

Container-ComponentContract

Page 15: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

15

Rationale for CCI

• Problem for development tools and EAI frameworks: – EISs support different client APIs– Need for adapting client APIs

• CCI solves this problem

...API nAPI 2API 1

Enterprise ApplicationIntegration Framework

EIS 2 EIS nEIS 1

Page 16: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

16

Overview of CCI

• Provides simple remote-function call API• Focuses on toolability• Leverages JavaBeans™ architecture-

based components and Collections • Targets EAI and application

development tools• Recommended for resource adapters in

version 1.0

Page 17: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

17

Scenario: EAI Framework

Common ClientInterface

JDBC 2.0 Repository

ResourceAdapter

JDBC 2.0Driver

Enterprise Application IntegrationFramework

Page 18: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

18

Scenario: CCI Usage// Get a Connectionjavax.naming.Context nc = new InitialContext();ConnectionFactory cf =

(ConnectionFactory)nc.lookup("...");Connection cx = cf.getConnection();

// Create an InteractionInteraction ix = cx.createInteraction();

// Create input and output RecordRecordFactory rf = //.. get a RecordFactoryMappedRecord input = rf.createMappedRecord("...");IndexedRecord output = rf.createIndexedRecord("...");

// Create/get an InteractionSpecInteractionSpec ixSpec = // ...ixSpec.setFunctionName("<NAME-OF-EIS-FUNCTION>");

// Execute the Interactionboolean ret = ix.execute(ixSpec, input, output);

Page 19: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

19

Packaging of Resource Adapter• Standard packaging format for

resource adapter– Packaged as JAR– Equivalent to "J2EE module"

• XML based deployment descriptor– General information– Configurable properties– Transaction support level– Security related configuration

Page 20: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

20

Deployment of Resource Adapter

ResourceAdapter

OperationalEnvironmentConfigured

Processedby Deployer

Created byResourceAdapter Provider

Resource Adapter Module

Packaged with other J2EE Modules

J2EE Container

Page 21: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

21

Status and Roadmap

• Defined through Java Community Process initiative

• Release Schedule:– Public draft 1: Released 06/2000– Proposed Final Draft 1: Released 10/2000– Final release: Q2 CY-2001

• Connector.next process initiation– Targeted for 02/2001

Page 22: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

22

Reference Implementationand CTS• J2EE™ RI with Connector support:

– Early access released in 10/2000– Beta release J2EE 1.3 RI: Q1-2001– Subsequent RI and CTS releases tied

with the J2EE 1.3 platform• Connector related J2EE RI features:

– System contracts on container side– Packaging and deployment– CCI-based sample resource adapter

Page 23: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

23

Connectors 2.0

• Proposed features:– Asynchronous resource adapters– JMS Pluggability– XML support in application contract– Metadata support

• Schedule for 2.0:– JSR targeted for 02/2001– Call for experts

Page 24: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

24

Industry Support

• Part of the J2EE 1.3 platform• Expert group for Connectors 1.0:

• BEA, Fujitsu, IBM, Inline, Inprise, iPlanet, Motorola, Oracle, SAP, Sun, Sybase,Tibco, Unisys

• Huge Java™ technology community interest:– Successful early access release– Strong support for resource adapter

providers

Page 25: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

25

Advantages of Architecture

• Application developers• Application server providers• Enterprise Information system vendors• Application development tools provider• Enterprise application integration

(EAI) vendors• Third-party ISVs

Page 26: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

26

Pointers and References

• Web resources:– http://java.sun.com/j2ee/– http://java.sun.com/j2ee/connector/

• Spec lead: [email protected]

Page 27: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

27

Java Message Service (JMS) 1.0

Rahul SharmaSenior Staff EngineerSun Microsystems, Inc.

Page 28: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

28

Agenda

• Overview of the Java™ Message Service API (JMS)

• JMS Reference Implementation• Preview of J2EE™ platform-based

component messaging• Future considerations

Page 29: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

29

What Is the JMS API?

• A common Java™ platform API for creating, sending, receiving and reading messages

• Enables communication that is– Loosely coupled– Reliable– Asynchronous

• Designed by Sun and partners• Released 11/1999

Page 30: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

30

JMS API Objectives

• Capable of mapping to existing Message Oriented Middleware (MOM) systems

• Enough functionality to support sophisticated messaging applications

• Enable the development of efficient JMS Providers

• Allow portability of a new JMS application across JMS products in same message domain

Page 31: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

31

JMS Functionality

• Two messaging domains– Point-to-Point (Reliable Queue)– Publish/Subscribe

• Message delivery– Synchronous or asynchronous– Reliability provided by acknowledgements

• Message selectors• Transactions• Choice of five Message types

Page 32: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

32

Point-to-Point Messaging

SendsClient 1 Client 2QueueConsumes

Acknowledges

• Only one consumer of queue message• No timing dependencies

between sender and receiver

Page 33: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

33

Client 1 Publishes

Client 3Delivers

Subscribes

Topic

Subscribes Client 2

Delivers

Publish/Subscribe Messaging

• Broadcast message to all subscribers

Page 34: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

34

Vendor Implementations

∀ See website:http://java.sun.com/products/jms/vendors.html

∀ 13 implementations of JMS API:(Note: Listing by vendor request, not all-inclusive)

BEA Systems, Inc. Fiorano Software, Inc.IBM objectCube, Inc.Oracle Corporation Orion Progress Software Saga Software, Inc.Softwired, Inc SpiritSoft, Inc.Sun Java Message QueueValto Systems Venue Software

Page 35: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

35

JMS Within the J2EE™ Platform• Enables J2EE components to

– Interact via first class distributed computing paradigm of message passing

– Interact with message-enabled legacy systems

• Uses an open standard API – Will allow freedom of choice among JMS

Providers

Page 36: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

36

Accessing JMS From an EJB™ Architecture-Based Component ("EJB Component")• Any EJB component type can send or

synchronously receive a message• Message-driven Bean enables

asynchronous invocation mechanism• Msg send and receive can participate in

JTA transaction• Described in the EJB 2.0 specification

Page 37: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

37

Goals of Message-Driven Bean

• As simple to write as any other JMS MessageListener

• Allow for asynchronous concurrent message consumption

JMS Provider

Container

Destin-ation

ConsumerMsg-driven

BeanInstances

Msg-drivenBean Class

Page 38: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

38

Message-Driven Bean Instance• Executes on receipt of a JMS message• Shares the following characteristics of

stateless session bean– Can be transaction-aware– May update shared data in an underlying

database– Is stateless and relatively short-lived– Notable difference:

No home or remote interface

Page 39: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

39

Overview of EJB Architecture Messaging Source Code Example

DataBase

EJB Server Subscriber

Msg-drivenInstances

Receives

Ackowledges

PublisherBean

ClientApp Durable

Subscription

Published

Database

Stores

EJB Server

ContainerContainerSubscriberMsg-drivenInstances

Delivers

Ackowledges

PublisherBean

ClientApp Durable

Subscription

Publishes

Page 40: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

40

Code for Publisher Beanimport javax.ejb.*;import javax.naming.*;import javax.jms.*;

public class PublisherEJB implements SessionBean {TopicConnection tconn = null;Topic topic = null;

// Cache lookup of JMS Connection and Destinationpublic void ejbCreate() throws RemoteException {Context ctx = new InitialContext("java:comp/env");topic = (Topic)ctx.lookup("jms/MyTopic");TopicConnectionFactorry tcfac = (TopicConnectionFactory)

ctx.lookup("jms/MyTopicConnectionFactory");tconn = tcfac.createTopicConnection();

}

// Release JMS connectionpublic void ejbRemove() throws RemoteException {if (tconn != null) tconn.close();

}

Page 41: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

41

Code for Publisher Bean (Cont.)

/*** Publishes a message to a topic.*/

public void publishNews() throws EJBException {

// Create JMS context to publish message to topicTopicSession tsess = tconn.createTopicSession(true, 0); TopicPublisher tpub = tsess.createPublisher(topic);

// Create and send messageTextMessage message = tsess.createTextMessage("News

item");tpub.publish(message);

// Release JMS resourcestsess.close();}

}

Page 42: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

42

Code for Message—Driven Beanpublic class SubscriberMsgBean implements MessageDrivenBean {

< define ejbCreate(), ejbRemove() andsetMessageDrivenContext(MessageDrivenContext mdc) >

/* Message acknowledge and database update participate* in distributed txn.*/

public void onMessage(Message inMessage) {TextMessage msg = (TextMessage) inMessage;

try {< look up JDBC database >< store info from message in database >

} catch(Exception e) {e.printStackTrace();

}}

}

Page 43: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

43

Benefits of JMS Within an EJB Component• Simplify enterprise development with

– Loosely coupled, reliable, asynchronous interactions between EJBs and other components

– Ease of extensibility of business events• Add a new message-driven bean to introduce

new business logic for existing business events• JMS functionality enhanced by EJB

container architecture– Distributed transaction support – Concurrent consumption of messages

Page 44: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

44

Conclusions

• The J2EE™ platform is ideal for enterprise development

• The Java™ Message Service API (JMS) enables asynchronous, loosely coupled, reliable communication among clients

• JMS adds messaging paradigm to J2EE platform

• J2EE container architecture enhances JMS functionality

Page 45: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

45

More Information

• Web sites– JMS: http://java.sun.com/products/jms– J2EE: http://java.sun.com/products/j2ee

• Mailing list– [email protected]

• Join at http://archives.java.sun.com

Page 46: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

46

EAI Scenario

Inventory ManagementApplication

<Mainframe system>

Logictics Application<ERP system>

Financial Application<ERP System>

Buyer

Order Database

eMarketplaceApplication Server

Order ManagamentApplication

Enterprise Messaging System

Customer Database

FulfillmentService Provider

Page 47: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

47

The J2EE™ Platform

Middle TierEIS Tier

Client

Client

Client

Client

Other Services:JNDI, JMS,JavaMail™

Enterprise JavaBean

Enterprise JavaBean

Enterprise Information

Systems (EIS):

Relational-Database,

Legacy Applications,ERP Systems

Client

Web ServerJSP, Servlet, HTML, XML

ApplicationServer

Client Tier

Firewall

Page 48: The J2EE Platform Connector Architecture 1 - · PDF fileJavaMail ™ Enterprise ... J2EE Connector Architecture Java Message Service Java API for XML Messaging JSP EJB JAXP Java Transaction

48

Using J2EE

Inventory ManagementApplication

<Mainframe system>

Logictics Application<ERP system>

Financial Application<ERP System>

Buyer

Order Database

eMarketplace

J2EE-based Application Server

Enterprise Messaging System

Customer Database

FulfillmentService Provider

JDBC

J2EE ConnectorArchitecture

Java Message Service

Java APIfor XML Messaging EJBJSP

JAXP

Java Transaction API

Inventory ManagementApplication

<Mainframe system>

Logictics Application<ERP system>

Financial Application<ERP System>

Buyer

Order Database

eMarketplace

J2EE-based Application Server

Enterprise Messaging System

Customer Database

FulfillmentService Provider

JDBC

J2EE ConnectorArchitecture

Java Message Service

Java APIfor XML Messaging EJBJSP

JAXPServlet

XML