WebSphere Application Server Messaging Configuring and...

27
1 Software Group © 2008 IBM Corporation p1 WebSphere Application Server Messaging Configuring and using MQ and SIBus Carl Farkas SW IOT TechWorks zWebSphere Application Integration Consultant IBM France D/2708 Paris, France Internet : farkas @ fr.ibm.com Notes : Carl Farkas/France/IBM @ IBMFR Software Group © 2008 IBM Corporation p2 Agenda Quickie review of JMS, MQ and SIBus Configuration options Configuration examples Bibliography

Transcript of WebSphere Application Server Messaging Configuring and...

Page 1: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

1

Software Group

© 2008 IBM Corporation p1

WebSphere Application Server MessagingConfiguring and using MQ and SIBus

Carl Farkas SW IOT TechWorks zWebSphere Application Integration ConsultantIBM France D/2708Paris, FranceInternet : farkas @ fr.ibm.comNotes : Carl Farkas/France/IBM @ IBMFR

Software Group

© 2008 IBM Corporation p2

Agenda

�Quickie review of JMS, MQ and SIBus

� Configuration options

� Configuration examples

� Bibliography

Page 2: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

2

Software Group

© 2008 IBM Corporation p3

Preamble

� WebSphere MQ (ex-MQSeries) has been sold by IBM since 1993. It is in

production by over 10,000 customers world-wide. It is estimated that MQ

transports between 65-80% of the ”business messages” today.

� WebSphere Application Server v6 arrived in early 2005 with its own built-in

messaging engine, the “SIBus” (sometimes called « Default Messaging Provider » or « WAS Messaging Bus » or

« Platform messaging » or etc. ! ;)

Which product provides the right messaging for you?

There most probably is no correct answer for this question in all

circumstances, but this presentation aims to provide some information on

how to use these messaging products separately as well as together, and to

provide some elements of comparison.

Software Group

© 2008 IBM Corporation p4

Transport layers

Page 3: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

3

Software Group

© 2008 IBM Corporation p5

Introduction JMS

� JMS is an API– Application Programming Interface to access an Enterprise Messaging System (or MOM) for

Asynchronous messaging

– Available to Java programs, JEE or simple Plain-Old-Java-Objects (POJOs)

– To execute the programs, you need access to a vendor implementation of JMS.

� “Enterprise Messaging”– Reliability – “once-and-once-only”

� Java Message Service (JMS) is a standard enterprise messaging API

– Defined by Sun, as part of J2EE (with strong IBM participation as part of “Expert Group”!)

– JMS interfaces supported since J2EE 1.2 (WAS v4.5)

– JMS implementation required since J2EE 1.3 (WAS v5)

– J2EE version 1.4 required J2EE products to include a JMS version 1.1 provider that supports both point-to-point and publish/subscribe messaging.

Software Group

© 2008 IBM Corporation p6

Objectives of JMS

The objectives of JMS, as stated in the specification,

are to:– Define a common set of messaging concepts and facilities.

– Minimize the concepts a programmer must learn to use enterprise

messaging.

– Maximize the portability of messaging applications.

– Minimize the work needed to implement a provider.

– Provide client interfaces for both point-to-point and pub/sub domains

("Domains" is the JMS term for the messaging models)

Page 4: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

4

Software Group

© 2008 IBM Corporation p7

What JMS does not provide� The following features, common in MOM products, are not

addressed by the JMS specification. Although acknowledged by

the JMS authors as important for the development of robust

messaging applications, these features are considered JMS

provider-specific.

� JMS providers are free to implement these features in any manner

they please, if at all:

– Load balancing and fault tolerance

– Error and advisory system messages and notification

– Administration

– Security

– Wire protocol

– Message type repository

� Other ESB functions…. Eg. routing and transformation

Software Group

© 2008 IBM Corporation p8

JMS objects

� Connection Factory: An administered object that creates a connection to the provider's underlying messaging system.

� Connection: An active connection to a provider.

� Session: A single-threaded context for sending and receiving messages.

� Message Producer: Used for sending messages.

� Message Consumer: Used for receiving messages.

� Destination: An administered object that encapsulates the identity of a message destination, such as where messages are sent to or received from.

Page 5: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

5

Software Group

© 2008 IBM Corporation p9

JMS example

ConnectionFactory myFactory;

TextMessage myOutMessage, myInMessage;

myFactory = (ConnectionFactory ctx.lookup(“jms/myConnFact”);

Connection myConnection = myFactory.createConnection();

myConnection.start();

Session mySession = myConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);

myQueue = (Queue) ctx.lookup(“jms/myLovelyQueue”);

Producer myProducer = mySession.createProducer(myQueue);

myOutMessage.setText("Salut les colins…");

myProducer.send(myOutMessage);

mySender.close();

Consumer myConsumer = mySession.createConsumer(myQueue);

myInMessage = myConsumer.receive(10000);

System.out.println(((TextMessage)myInMessage).getText());

myConsumer.close();

mySession.close();

myConnection.close();

Setup

Send message

Receive message

Cleanup

Software Group

© 2008 IBM Corporation p10

Review: what is WebSphere MQ?� A simple, efficient API for sending/receiving data

messages

� Enables fast, reliable asynchronous messaging from application to application

� An industry standard for Message-Oriented-Middlewares (MOM) with 65-80% of the market.

� Can be used on over 45 different platforms(Windows, Linux, AIX, Solaris, HP-UX, iSeries-AS/400, etc, etc., and of course…… System Z !)

� Can be used from all major programming languages (C, C++, COBOL, Fortran, BAL, PL/I, Java/JMS, VB, RPG, etc.)

� Includes support for the MQ Client – a remote API accessing the queue manager resources.

� Other unique features of MQ…

– Fully transactional with its own 2PC transaction manager for distributed MQ and working with RRS on z

– Support for high-availability and load-balancing via MQ Cluster as well as Sysplex on Z

– Support for point to point and pub/sub messaging

– Support for message grouping and segmentation

– Support for SSL authentication and encryption

– Support for message compression

– Etc.

:

:

:

:

Application

:

ioQueue = session.createQueue(

« MaFile » );

QueueSender queueSender =

session.createSender(ioQueue);

queueSender.send(outMessage);

:

Network transport

WebSphere MQ

API MQ

Page 6: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

6

Software Group

© 2008 IBM Corporation p11

Review: what is WAS Service Integration Bus (SIBus)?

� WAS v5 included a JMS provider: a modified version of WebSphere

MQ v5.3

– Limitations on usage, integration

– Issues with scalability, single point of failure

– No connectivity with external WebSphere MQ (but replaceable with a full version of

MQ which provided the connectivity, of course!)

� Beginning with WAS v6, a native messaging feature called the

Service Integration Bus (SIBus) is included with WAS

– A JEE-compliant fully integrated JMS provider

– 100% Java code

– A “motor” for point-to-point and pub/sub messaging

– Intermediary logic (mediations) to intelligently adapt message flows

– Several connectivity options with MQ

– Leverages WAS architecture the QOS, eg. scalability, HA, security, etc.

Software Group

© 2008 IBM Corporation p12

Node

SIBus Topology Elements & terminology� Bus

– A cell-wide resource which provides a namespace for resource definitions and points of connectivity for clients

– logical application connection point

– hosts logical destinations

– A cell can contain multiple buses

– Buses can be linked together, or to MQ

� Bus Member– server or cluster hosting messaging capability and

destination owner

� Messaging Engine (ME)– component of server

– For each Bus Member added to a Bus, at activation, a Messaging Engine is instantiated, either in the single AppServer or at least one AppServer within a Cluster

– physical application connection point; when applications connect to the SIBus, they are physically connected to the “closest” ME within the bus

� Datastore– ME component handling persistence of messaging

state

– uses Cloudscape (default) or other supported database, or file as of WAS 6.1

Cell

Node

AppServerAppServer

AppServer AppServer

ME

Cluster

ME ME

Green bus

ME

ME

Red bus

Page 7: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

7

Software Group

© 2008 IBM Corporation p13

SIBus and/or MQ?WebSphere SIBus

WebSphere MQ

� Generally for a WAS-only environment

� Primary objective: messaging in JEE world

� A relatively new component for WAS

offering tight WAS integration for

administration, but a limited amount of OEM

administration products today

� Uses the WESB product as the natural ESB

extension for routing and transformation

� For a heterogeneous environment, eg.

Java and non-Java, with large platform

support, including “exotic” platforms

� Primary objective: messaging

� A long history of industrial-strength

messaging

� Mature product with a wealth of admin tools

� Uses the WebSphere Message Broker as

the natural ESB extension for message

routing and transformation

Remember: you don’t need to choose between them.

MQ and SIBus are fully interoperable!

Software Group

© 2008 IBM Corporation p14

QM z/OS

QM z/OS

JMS configuration choices – there are several!

WAS

ME QM

1

3MQ

Server2

MQ Link

4

QM

5QM

� JMS configuration with SIbus objects

1. SIBus “pure” – the messages stay in the SIBus world

2. SIBus peer-to-peer with MQ : MQ Link

3. SIBus front to MQ : MQ Server

� JMS configuration with MQ objects

4. MQ direct connection to a local Queue Manager, called “bindings”

5. MQ network connection to a Queue manager, called MQ “client” mode

� JMS configuration with other providers also possible (but why? ;>)

Page 8: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

8

Software Group

© 2008 IBM Corporation p15

cf = (ConnectionFactory)

ctx.lookup(Nom_de_ma_ConnectionFactory_JNDI);

connection = cf.createConnection();

session = connection.createSession(...);

queue = (Queue) ctx.lookup(Nom_de_ma_File_JNDI);

producer = session.createProducer(queue);

connection.start();

msg = session.createTextMessage(myQueueText);

producer.send(“aux armes citoyens…”, ...);

connection.close();

How do I use JMS from WAS?� Write a Java program that uses the JMS class libraries

– This is done by the developer

� Define the logical resources

– These JMS “pointers” are accessed via JNDI (not strictly necessary)

– They are independent of the program

– They are defined by a WAS namespace administrator

� Define the physical resources (eg. Queues)

– They are defined by a WAS or MQ messaging administrator

Application (code)

JNDI

JMS Provider

Software Group

© 2008 IBM Corporation p16

SIBus – pure WAS messaging

� For messaging purely in the WAS environment

� Can be extended beyond the WAS cell also…. Other SIBuses, or to MQ world

1

WAS

ME

1

A. Define the “physical resources”

1. First create the SIBus

� Only needs to be done once per WAS Cell (although multiple buses are certainly allowed)

2. Add Bus Members (eg. Application servers, cells…)

3. Create your Destinations

B. Define the JMS “pointers”

4. Define the Connection Factory

5. Define the Destination pointer (eg. Queues or Topics)

Page 9: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

9

Software Group

© 2008 IBM Corporation p17

1. SIBus - Create the SIBus

� Service integration > Buses > New then…. Save

� The simplest “wizard” in the world!

1

Software Group

© 2008 IBM Corporation p18

2. SIBus - Add the Bus member

Buses > Your_SIBus > Bus members > Add

� Bus members define the members of the SIBus

� Messaging engines (MEs) are instantiated to represent the Bus members

1

Page 10: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

10

Software Group

© 2008 IBM Corporation p19

2. SIBus - Add the Bus member, cont’d

� Adding a (WAS) Cluster is the key to High-availability

� “WebSphere MQ Server” option to be discussed later

� The “File store” option was added with WAS v6.1– Simpler to configure

– Faster performance (unless DB is externalized)

– A JDBC database probably more robust for HA� Be sure to Save and Restart your WAS

1

Software Group

© 2008 IBM Corporation p20

3. SIBus - Create the Destination

Service integration > Buses > Your_SIBus > Destinations > New….

1

Page 11: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

11

Software Group

© 2008 IBM Corporation p21

3. SIBus – Create the Destination, cont’d

� A Destination is “owned” by a Bus member; the BM owns the resources

� Alias, Foreign (as well as MQ Server Queues) create pointers only

– Similar to a MQ Alias and Remote Queue

– Probably best to just use the Alias

– A JMS program can optionally directly address a queue without using a pointer

1

Software Group

© 2008 IBM Corporation p22

4. JMS – Define a Connection Factory� The Connection Factory is the JNDI-administered object that a program connects to

and provides the interface to the messaging system

– Creates a “handle”; in MQ terms, this is like an MQCONN (although strictly speaking, it’s

actually the createSession that does the MQCONN)

� Careful! There are 3 choices!

– Connection Factory – if your JMS application uses JMS 1.1 (nice work!)

– Queue and Topic Connection Factories – if your JMS application is older (time to update!)

� One CF per messaging provider is often sufficient

Resources > JMS > Connection Factory > New

1

Page 12: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

12

Software Group

© 2008 IBM Corporation p23

4. JMS – Define a Connection Factory, cont’d

� Other provider choices can also appear (eg. WAS “v5 default messaging”, xyz

messaging, etc)

� You must select the SIBus or QM that you want to work with here

� Other connection factors (eg. Security, transactionality, performance pooling) are here

1

Software Group

© 2008 IBM Corporation p24

5. JMS – Define the destination pointerResources > JMS > Queues > New > Default messaging provider

1

Specify the JNDI name used

by Java application

After selecting the SIBus to

be queried….

…. the known queue names

will be proposed. Cool!

Page 13: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

13

Software Group

© 2008 IBM Corporation p25

SIBus MQ Link

WAS

ME QM

2

MQ Link

2

� A WAS “MQ Link” emulates a WMQ Queue Manager.– The MQ Queue Manager thinks that it’s another MQ on the other side!

– A simple peer-to-peer relationship

� Unidirectional channels connect the Messaging Engine with the QM

� Standard store ‘n forward messaging between the SIBus and the QM

A. Define the “physical resources”� Define QM, MQ queue, channels on MQ by the MQ administrator

1. First define a Foreign Bus on the SIBus

2. Next define the MQ Link

3. Create your Destinations - Alias

B. Define the JMS “pointers”4. Define the Connection Factory

5. Define the Destination pointer (eg. Queues or Topics)

Software Group

© 2008 IBM Corporation p26

MQ Link – SIBus networks

SIBus

QMgr

ME

QMgr

QMgr

QMgr

QMgr

� An MQ Link can be used as a “gateway” into the MQ world

� Or as a router between different SIBus worlds

� Or as a router between different MQ worlds

� Messages are fully preserved between worlds– By MQMD properties when possible

– Otherwise kept in SIBus folder in RFH2

SIBus

2

Page 14: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

14

Software Group

© 2008 IBM Corporation p27

1. MQ Link – Define the Foreign Bus� The Foreign Bus is a “proxy” within the SIBus to represent another bus (SIBus, MQ, etc)� Bus “Name” should typically be that defined by the partner

Service integration > Buses > your_Bus_name > Foreign buses

2

Software Group

© 2008 IBM Corporation p28

2. MQ Link – Define the MQ Link� The MQ Link gets defined on the runtime Messaging Engine of an SIBus

� Be sure that the SIBus is defined and WAS restarted

Service integration > Buses > Your_SIBus > Messaging engines > Your_ME then….WebSphere MQ links > New

2

Page 15: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

15

Software Group

© 2008 IBM Corporation p29

2. MQ Link – Define the MQ Link, cont’d

Service integration > Buses > Your_SIBus > Messaging engines > Your_ME then….WebSphere MQ links > New

Name of SIBus’

virtual QM

Must match MQ

RECEIVER

channel definition!

Must match MQ

SENDER channel

definition!

2

Software Group

© 2008 IBM Corporation p30

2. MQ Link – Define the MQ Link, cont’d� And on the MQ side, it looks like this

� Note that the channel names must match exactly on both sides!

� Use the port number SIB_MQ_ENDPOINT_ADDRESS found at Application

servers > your_server > Ports to define the MQ Sender Connection name (port)

SIBus → MQ Receiver

MQ Sender → SIBus

Must match the SIBus

MQLink Sender

channel

Must match the SIBus

MQLink Receiver

channel

Must match the SIBus

MQLink Receiver

channel

2

Page 16: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

16

Software Group

© 2008 IBM Corporation p31

3. MQ Link - Create the SIBus Destination

Service integration > Buses > Your_SIBus > Destinations > New….

2

Software Group

© 2008 IBM Corporation p32

3. MQ Link - Create the SIBus Destination, cont’d� Alias and Foreign options create pointers only

– Similar to a MQ Alias and Remote Queue

– Probably best to just use the Alias

– A JMS program can optionally directly address a queue without using a pointer

� More sophisticated (complex!) Target Identifier’s can be used (eg. MyQueue@QMgrY) to route via a gateway Target bus

The Foreign

bus name

The exact MQ

queue name

2

Page 17: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

17

Software Group

© 2008 IBM Corporation p33

4. JMS – Define a Connection Factory5. JMS – Define a destination pointer� These two steps are essentially identical to what we saw earlier for a “pure” SIBus definition.

� As before, create a Connection Factory to “point to” the SIBus

� As before, create a destination pointer (eg. Queue or Topic) for the particular resource that

we just created above.

Choose the queue name

alias defined on the

SIBus in the prior step

Name referred to by

Java JMS program

Resources > JMS > Queues > New > Default messaging provider

2

Software Group

© 2008 IBM Corporation p34

SIBus MQ Server3

� A WAS “MQ Server” connects to a WMQ Queue Manager using a… “MQ Client” (!!)– Only supported by WebSphere MQ on z/OS

– Can also use MQ “bindings” mode (if WAS running locally with MQ)

� Bi-directional connection between the Messaging Engine with the QM yielding “local-

like” interface to MQ (synchronous putting and getting messages)

� Fully exploits MQ as the queue resource holder (eg. Shared queue access)

A. Define the “physical resources”� Define QM, MQ queue, channels on MQ by the MQ administrator

1. Define a MQ Server on the SIBus

2. Add the MQ Server as an SIBus member

3. Create your Destinations - Alias

B. Define the JMS “pointers”4. Define the Connection Factory

5. Define the Destination pointer (eg. Queues or Topics)

WAS

3 MQ

Server QM z/OS

QM z/OS

Page 18: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

18

Software Group

© 2008 IBM Corporation p35

1. MQ Server – Define the MQ ServerServers > WebSphere MQ server > New

Must match the

real QM

name

If you’re lucky

enough to have

WAS on z/OS!

3

Logical name for my MQ

queue manager as

seen by WAS

Software Group

© 2008 IBM Corporation p36

2. MQ Server – Add MQ Server as Bus MemberService integration > Buses > Your_bus > Bus members > Add

3

Page 19: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

19

Software Group

© 2008 IBM Corporation p37

3. MQ Server - Add the SIBus Destination

Service integration > Buses > Your_SIBus > Destinations > New….

� You must add the queue definition (and not an Alias), but this isn’t the “physical” queue

definition; you still must use MQ administration to create the queue.

3

Software Group

© 2008 IBM Corporation p38

3. MQ Server - Add the SIBusDestination, cont’d� After selecting the MQ Server as the Bus member, the WAS Admin Console

wizard automagically presents the MQ queue names available.

Select the BM

created in

prior step

Important for MQ “legacy”

compatibility

3

Page 20: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

20

Software Group

© 2008 IBM Corporation p39

4. JMS – Define a Connection Factory5. JMS – Define a destination pointer� These two steps are essentially identical to what we saw earlier for a “pure” SIBus definition.

� As before, create a Connection Factory to “point to” the SIBus

� As before, create a destination pointer (eg. Queue or Topic) for the particular resource that

we just created above.

Choose the queue name

defined on the SIBus in

the prior step

Name referred to by

Java JMS program

Resources > JMS > Queues > New > Default messaging provider

3

Software Group

© 2008 IBM Corporation p40

MQ direct connection

WAS

4

QM

4

� Requires a WebSphere MQ Queue Manager installed locally on the same machine

as WAS

� Takes full advantage of MQ store ‘n forward messaging

� Minimises WAS resources – no need to create an SIBus at all

� Uses MQ-supplied class libraries over native (JNI) interface

� Reduced “visibility” from WAS

A. Define the “physical resources”� Done on MQ by the MQ administrator

B. Define the JMS “pointers”1. Define the Connection Factory

2. Define the Destination pointer (eg. Queues or Topics)

Page 21: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

21

Software Group

© 2008 IBM Corporation p41

1. JMS – Define a Connection Factory� This is identical to what was seen earlier for addressing the SIBus resources, except the

WebSphere MQ messaging provider is chosen

� Many other connection factors (eg. Security, transactionality, performance pooling,

pub/sub interface, etc.) are here

– Note: requires CF Provider property set to v6 if

using MQv7 prior to 7.0.1 on z/OS. Also, MQv7.0.1

pre-reqs WAS FixPack 6 for Bindings mode. See

SWG21316899 for details.

� Resources > JMS > Connection Factory > New

This is the critical option to

indicate a direct, local

MQ connection

4

Software Group

© 2008 IBM Corporation p42

2. JMS – Define the destination pointer

Resources > JMS > Queues > New > WebSphere MQ messaging provider

� Again, this is identical to the JMS definition seen earlier for addressing the SIBus

resources, except the WebSphere MQ messaging provider is chosen

4

Page 22: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

22

Software Group

© 2008 IBM Corporation p43

2. JMS – Define the destination pointer, cont’d� This is where most default message-specific properties are defined

Specify the queue name

defined on MQ

Determines if MQ RFH2

used for JMS properties

Specify the JNDI name used

by Java application

4

Software Group

© 2008 IBM Corporation p44

MQ network connection5

� Requires a WebSphere MQ Client which connects to a Queue Manager typically

installed remotely on a different machine than the WAS (CAF required on MQ z/OS)

� Uses a single, bi-directional MQ channel providing remote MQ API access

� Takes full advantage of MQ store ‘n forward messaging

� Minimises WAS resources – no need to create an SIBus at all

� Uses MQ-supplied class libraries

� Reduced “visibility” from WAS

� Lower throughput and greater WAS overhead than the MQ direct connection

A. Define the “physical resources”� Done on MQ by the MQ administrator

B. Define the JMS “pointers”1. Define the Connection Factory

2. Define the Destination pointer (eg. Queues or Topics)

WAS

4

QM

5QM

Page 23: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

23

Software Group

© 2008 IBM Corporation p45

1. JMS – Define a Connection Factory� This is almost identical to what was seen earlier for the MQ direct connection, except the

WebSphere MQ Queue Manager host connection parameters must be supplied

� Many other connection factors (eg. Security, transactionality, performance pooling,

pub/sub interface, etc.) are here

Resources > JMS > Connection Factory > New

This is the critical option to

indicate a network MQ

connection

Specify the exact QM name

along with the IP address

and port

Specify the exact QM name

along with the IP address

and port

Specify the exact QM name

along with the IP address

and port

5

Software Group

© 2008 IBM Corporation p46

2. JMS – Define the destination pointer� This is identical to the JMS definition seen earlier for addressing the MQ direct

connection resources

Resources > JMS > Queues > New > WebSphere MQ messaging provider

5

Page 24: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

24

Software Group

© 2008 IBM Corporation p47

Message Driven Beans (MDB) � Message Driven Beans (MDBs) are used to “wake up” and receive a message upon

arrival of the message in a queue

� The application (Java class) is pre-loaded by WAS

� Extremely simple mechanism – essentially no messaging code to develop!

� You must tell WAS which queue to monitor

– For SIBus (pure JCA 1.5), this is done via an Activation specifications

– For MQ, this was done via a Listener Port prior to WAS v7; Listener Ports now deprecated

� Link to application is pre-configured in EAR, or by Enterprise applications menu >

your_app > MDB listener bindings

JNDI

SIBus

L-Port

public void onMessage(javax.jms.Message msg) {

System.out.println("===> Woke up with :" +

msg);

}

MQ

WAS

Application

Software Group

© 2008 IBM Corporation p48

Message Driven Bean (MDB) with the SIBus

Resources > JMS > Activation specifications > New > Ok

JNDI (JMS) name

of queue

Application specification

refers to this JNDI

(JMS) name

Page 25: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

25

Software Group

© 2008 IBM Corporation p49

Message Driven Bean (MDB) with MQ (WAS v6.1)Application servers > your_app_server > Messaging > Message Listener Service >

Listener Ports > New

JNDI (JMS) name

of queue and CF

Application specification

refers to this name

Software Group

© 2008 IBM Corporation p50

Message Driven Bean – application link - port� Application link to Activation Spec or Listener Port typically in the .jar with the .ear

� Otherwise… it can be defined at application installation time or later by

Enterprise Applications > your_WAS_Appli > MDB listener bindings

<ejbBindings xmi:type="ejbbnd:MessageDrivenBeanBinding" xmi:id="MessageDrivenBeanBinding_1108036949665"

listenerInputPortName="LP">

<enterpriseBean xmi:type="ejb:MessageDriven" href="META-INF/ejb-jar.xml#testMDB"/>

</ejbBindings>

Choose this for waiting

on MQ message

Choose this for waiting

on SIBus messageAlternatively for SIBus or

MQ with WASv7,

specify JNDI ActSpec

name here

Page 26: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

26

Software Group

© 2008 IBM Corporation p51

z/OS WAS v7: Don’t forget to enable the CRA

� With WAS v7, Listener Ports are no longer supported; you need to use an

Activation Specification, which is consistent now with SIBus

� Minor “gotcha”: on z/OS, you need to

– Make sure the Control Region Adjunct starts (not the default unless SIBus is configured)

– Be sure that the target queue is set SHARE & DEFSOPT(SHARED)

– Be sure that you are using MQ v7.0.1 at a minimum with WAS v7

Software Group

© 2008 IBM Corporation p52

To be added…. Quand j’aurai le temps

� Administration

� Sécurité

� Qqs exemples Pub/Sub

� Plus d’info sur la conversion formats MQ-JMS

� Il faut modifier “étapes” pour qu’elles soient comparables (eg. Chacun crée un

SIBus…)

Page 27: WebSphere Application Server Messaging Configuring and ...guide.webspheremq.fr/docs/WebSphere_messaging_configuration... · WebSphere Application Server Messaging Configuring and

27

Software Group

© 2008 IBM Corporation p53

Bibliography

� Required reading:

– Using WMQ messaging provider for WAS v7, http://www.ibm.com/support/docview.wss?uid=swg21316899

� WAS v7 InfoCenter

– http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp

� WebSphere Application Server V7.0 Messaging Administration Guide

(SG24-7770, Redbook)

� Introducing the Java Message Service, (DeveloperWorks)

http://www.ibm.com/developerworks/edu/j-dw-jms-i.html

� WebSphere Application Server V6 Default Messaging Provider Problem

Determination, WSTC Redpaper (REDP-4076)

� IBM developerWorks

– http://www.ibm.com/developerworks

– (Searching on “Service Integration Bus” returns a number of interesting articles)