Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 68

MQSeries Administration

and Programming

Houston
Sep. 25 2002
Part1: J2EE introduction

Houston
Sep. 25 2002
J2EE Overview
 E_business History
 What is J2EE
 J2EE components
 J2EE services
 Benefit of J2EE
 J2EE architecture
Early Web Sites: static
 Problem
 Organizations want to make their
information available to as many people as
possible
 Strategy
 Use the World Wide Web
 Web master authors static HTML pages
 Client: browser only
 Server: HTTP services
Improved client interface
 Problem:
 User see passive presentations
 Strategy:
 Improve presentation with Applet programs
 Client side execution
 Client: applets, javaScript
 Server: web server
Next evolutionary step
 Problem:
 Can not display back-end data
 Strategy:
 Use servlets for dynamic content
 Server side execution
 Client: applet, javaScript
 Server: servlet, app. Server,DB
Improved: componentry
 Problem:
 HTML changes require program changes
 Strategy:
 Use JSP and JavaBean
 Server side scripting
 Client: applet, JavaScript
 Server: Servlet, JSP, JavaBean, DB
New web app. architecture
 Problem:
 HTML changes require program changes
 Strategy:
 Use JSP and JavaBean
 Server side scripting
 Client: applet, JavaScript
 Server: Servlet, JSP, JavaBean,
EJB,DB
Enterprise Scalability
challenge
 Problems:
 Processor capacity is exceeded
 Multiuser transactions are complicated
 Strategy:
 Use Multiple Application server--clone
 A networked cluster of computers can be configured
as a single domain for HTTP and application services
 Fail-over service
What is J2EE
 J2EE stands for Java 2 platform,
enterprise edition
 A set of related specifications
 IBM contributed to over 80% of the
J2EE APIs
 Focus on server-side programming
Benefits of server-side
program
 Distribution
 Performance
 Network optimization
 Scalability
 Security
 Maintenance
 Project management
Benefits of server-side
program
 Testing
 Recovery
 Tools
 Data integrity
 Growth of the internet
J2EE Platform
Technologies

components services
J2EE

communication
Components
 Application level software unit
 Implemented by application
developers
 Run inside a container provided by
J2EE platform provider
 Container offers services and
communication support
Services & communication
 Services:
 Functions utilized by J2EE
components
 APIs implemented by J2EE platform
providers ( like WebSpher )
 Communication
 Enable communication between
collaborating components
 Provided by container
J2EE components--servlet
 Servlets are Java classes which
extend the
javax.servlet.http.HttpServlet
interface
 Focus on control and application logic
 j2EE 1.2 requires:
 Servlet 2.2 specification
 Supported by:
 WebSphere Application Server. V 4.0
 WSAD 4.0
J2EE components-- JSP
 HTML of XML document
 Embedded JSP tags
 Markup tags
 Allows clean separation of presentation of
dynamic content (JSP) from the generation
of the dynamic content ( servlet and relative
technologies)
 Can be built by Page Designer of
WSAD
 Web Container parses and
compiles the JSP into a Java servlet
J2EE components-- EJB
 EJB architecture is a server-side
technology for developing and
deploying distributed business
logic components
 J2EE 1.2 specification includes EJB
1.1
 WebSphere 4.0 fully supports
EJB1.1
J2EE components-- EJB
 Enterprise JavaBean
 Session bean

Stateless session bean

Stateful session bean
 Entity bean
 CMP
 BMP
J2EE components– EJB

EJB

Session
Entity

CMP BMP Stateless Stateful


J2EE Services -- JDBC
 Provides database-independent
connectivity to a variety of relational
databases
 J2EE 1.2 specifies:
 JDBC 2.0 Core APIs-Basic database
services
 JDBC 2.0 Extension APIs – Advanced
function

-Connection pooling

-Transactional capabilities
J2EE Services -- JNDI
 JNDI allows components to store and
retrieve named java objects
 J2EE 1.2 requires JNDI 1.2 level
 To access its naming context, a
component creates a
javax.naming.InitialContext object
 System-provided objects(eg.
UserTransaction) are stored in
java:comp/env in the JNDI name
space
J2EE Services -- JNDI
 User-defined objects are stored in
subcontexts of java:comp/env
 -java:comp/env/ejb
 -java:comp/env/jdbc
J2EE Services -- JMS
 The Java Message Service (JMS)
specification provides developers
with a standard Java API for
enterprise messaging services
such as reliable queuing, publish
and subscribe communication and
various aspects of push / pull
technologies
J2EE Services -- JTA
 JTA is the API and JTS is the
implementation of J2EE’s
transaction subarchitecture
 JTA is a implementation-neutral
interface to distributed
transactions
 Two way to start a transaction:
 Programmatic (in the code) using the
javax.transaction.UserTransaction interface
 Declarative -- using EJB CMT
J2EE Services -- security
 J2EE access control involves Authentication
and Authorization
 Authentication –verify the user’s identity
 Authorization –determine if the user has
permission to access the requested
resource
 -authorization based on roles
 -roles can contain users or groups of users
 Permissions are mapped by Deployer
Multitier architecture
Web tier Business tier EIS tier
Client tier

JSP RDB

Servlet JavaBean EJB Legacy


System
client

J2EE Server
J2EE: Containers
 Each component runs inside a container
which is provided by the J2EE platform
provider
 This container provides specific
deployment and run-time services to
the component( lifecycle, security,
transactions and so on )
 What services are provided depends on
the type of container
J2EE Object Model
J2EE Approach
 Component-based approach for developing,
deploying, and managing multitier, distributed,
enterprise application
 Components depend on the run-time support
of system-level entities called containers
 Containers provide:
 Life-cycle management
 Deployment
 Threading
 Many component behaviors can be customized
declaratively when deployed in a container
Benefits of J2EE
 Simplified architecture and
development
 Variety of standard services, components
and clients
 Choices of tools
 Portability
 Integration with existing information
systems
 Separation of responsibilities
 Scalability
 Flexible security model
Platform roles(1)
 J2EE product provider
 Implements a J2EE product that provides
containers, APIs, and other features
 Application component provider
 Produces application building blocks(HTML,
EJBs, JSPs, and so on)
 Application assembler
 Uses GUI tools to build applications from
building blocks
Platform roles(2)
 Deployer
 Deploys components and applications to a
specific environment
 System administrator
 Configures and administers infrastructure
 Tool provider
 Provides application component
development and packaging tools
WAS / MQSeries / JMS
 WebSphere Application Server
- A Java transaction server
- A EJB programming model to run business logic
- Synchronous model
 MQSeries
- MOM and Integration infrastructure
- 35 platforms & popular languages
- Asynchronous /Synchronous model
 JMS(Java Message Service)
- Standard for Java platform to access a JMS
provider(e.g., MQSeries)
JMS
 JMS is a specification of Java interface with a
MOM product
 Designed by Sun Microsystems
 Asynchronous model
Application B
Application A

JMS API JMS API

message message
JMS Client JMS Client

JMS Provider/ MOM Server


Domain of JMS
The category that a middleware falls into is
called its Domain.
It defines which client receives a message.

JMS Supports:
 Point-to-Point (Queue)

- One to One ( sender knows receiver)


 Publish–Subscribe (Topic)
- Many to Many(pubs don’t know subs)
Publish a message in JMS
 Look up connection factory from JNDI
 Create and start a connection
 Create a session
 Look up the destination
 Create a publisher
 Create a message
 Conduct Communication
Subscribe a message in
JMS
 Look up connection factory from JNDI
 Create and start a connection
 Create a session
 Look up the destination
 Create a Subscriber
 Install an asynchronous listener on the
subscriber object
Calling sequence
JNDI

MOM Server
1 4
connection Destination
factory
connection 5
Client
2
Destination
message

3
Session
Sample code
// Step 1. retrieve connection factory from JNDI
QueueConnectionFactory factory =
(QueueConnectionFactory)context.lookup(conn_name);
//Step 2. Create connection
QueueConnection connection =factory.createQueueConnection();
Connection.start();
//Step 3. Create session
QueueSession session = connection.createQueueSession(transacted,
acknowledgeMode);
//Step 4. retrieve destination from JNDI
Queue queue=(Queue)context.lookup(queue_name);
//Step 5. Create sender/receiver
QueueSender queueSender = session.createSender(queue);
QueueReceiver queueReceiver=session.createReciever(queue);
//Step 6. Send and receive message
TextMessage outMessage = session.createTextMessage();
queueSender.send(outMessage);
Message inMessage = queueReceive();
Message-Driven Bean
(MDB)
 EJB 2.0 specification: Message Driven Bean
 MDBs are an integration of JMS and EJB.
 MDBs don’t have clients, they are JMS
message listeners.
 JMS provider and EJB container cooperate to
deliver the message to MDBs.
 Messaging allows asynchronous model.

Send/Pub Receive/Sub
JMS Client JMS QUEUE / Topic MDB
Message-Driven Bean
features
 Asynchronous Invocation
 A MDB is an EJB without home or remote
interface.
 A MDB is a JMS message consumer.
 Don’t have client visible identity.
 Controlled by EJB container.
 Execute as stateless services.
MDB Implement
 MDB doesn’t have a remote or a home interface.
 A MDB is a bean class that implements the following two
interfaces:
javax.ejb.MessageDrivenBean
javax.jms.MessageListener

javax.ejb.MessageDrivenBean javax.jms.MessageListner

MessageDrivenBean
What softwares needed
 MA88 support pack from IBM
 MQSeries 5.2
 WebSphere Advanced Edition V3.5,
Fixpack 3 (JDK1.2.2) or WAS 4.0
WebSphere 3.5
MQSeries 5.2
Fixpack 3 EJB Container
MA88
MA88-MQ Java classes
 Provides Java language support for
MQSeries applications.
 Implements an OO model for accessing
MQSeries resources.
 Support various connection/transport
options (TCP/IP, CORBA/IIOP, etc).
 Gives parity with support for C/C++,
Cobol.
MA88-MQ Java classes
 MQSeries JMS implementation
-Utilizes MQSeries classes for Java to access
MQSeries resources.
 Provides extra function over
MQSeries classes for Java.
- Asynchronous message delivery, Message
Selectors
Transactional Support, Structured message
classes
 Admin Tool for defining
administered objects and place
Part 2: MQSeries
Introduction

Houston
Sep. 25 2002
MQSeries –Commercial
Messaging
 Common application programming
interface
 Assured message delivery
 Time independent processing
 Application parallelism
 Faster application development
Message:
 A message is:
 A unit of information
 A request for a service
 A reply
 A report
 An announcement
Queue:
 A safe place to store message
 Lined up for service
 Ready for delivery
 FIFO or Priority
Applications enabled by
MQ
 Program to program
communication for
 Message driven processing
 Client / server implementation
 Distributed processing
 Components of an application can
run independently on different
systems and environments
Applications enabled by
MQ
 Applications with several
processing steps
 Some fast
 Some slow
 Some not immediately available
 No loss or duplication of
information
Queue manager
 A queue manager owns and
manages queues and other
objects.
 Common application programming
interface
 Message Queue Interface (MQI)
MQI calls(1)
 You can send messages at one
end…
 MQPUT
 MQPUT1
 … and they arrive reliably at the
other
 MQGET
 Generally, a message are added to
the end of a queue and is removed
from the front of a queue
MQI calls(2)
 Other calls
 MQCONN, MQCONNX, MQDISC

Enable an application to connect to or disconnect
from a queue. An app. Must connect to a queue
manager before it can issue any further MQI calls
 MQOPEN, MQCLOSE

Enable an application to open a queue for
specified operations and close the queue . An app
must open a queue and then can PUT or GET
MQI calls (3)
 MQINQ and MQSET
 Inquire on and set the attributes of an
object.
 MQBEGIN, MQCMIT and MQBACK
 Enable an application to put or get
messages as part of a unit of work
Message Descriptor
 Each message has a message
descriptor
 Application determines message
content
 A message consists of two parts:
 Message descriptor
 Application data
Message descriptor Application data
Asynchronous Model(1)

Program A

Q1
Program B
Q2
Program C
Asynchronous Model(2)
 Separate process for replies
 Communicating programs don’t
have to be active at the same time
 Time independence
Triggering

Program B
Program A Queue MQGET
MQPUT

Process obj

Trigger Moni

Init queue
Triggering
 Triggering allows:
 Instantiation as required
 Conservation of system resources
 Automation of flow
 More detail later
Parallel processes
AIRPLANE
MQPUT AIR

MQPUT CAR CARRENT


MQPUT HOT

MQGET ALL
HOTEL
Client / Server

Insurance
Agent1

Insurance Insurance
Quotation data
2

3
Client / Server
 The server application, insurance
quotations, can handle requests
from multiple client applications.
The message descriptor identifies
the appropriate reply-to queue for
each request
Assured Delivery
 This is another benefit of
MQSeries. It is the result of the
protocol used when one queue
manager transmits a message to
another queue manager. The QM
and protocol ensures that no
message is lost or delivered more
than once.
Connectionless
Communication

programA programB ProgramC programD

Q1
Qt Q2

QM1 QM2
Connectionless
Communication
 When applications connected to
one QM are putting messages on
multiple queues owned by another
QM. Only one transmission queue
is required to stage the delivery of
these messages, and only one
communication connection is
required between the two QM

You might also like