Help a newbie with MQ - Websphere
This is a discussion on Help a newbie with MQ - Websphere ; Not sure if this is the right place to ask the question, but here goes.
I am fairly new to working with J2EE, about a year now. I work on an existing J2EE app deployed to WL 10. At a ...
Help a newbie with MQ
Not sure if this is the right place to ask the question, but here goes.
I am fairly new to working with J2EE, about a year now. I work on an existing J2EE app deployed to WL 10. At a very high level we have an enhancement project in which a back end mainframe process is going to create a dataset that is in essence a .csv file. These datasets will be created during a mainframe batch process run during certain time windows. These resulting data sets will also need to be zipped, encrypted and put onto a secure file storage mount where they can be downloaded via the web. As part of out deployment we have a server running that handles non-transactional, non-user invoked processing. It will fall to this J2EE application to handle the zip, encrypt and movement of these files to the file storage mount.
There is an option on the table to look at using MQ Series to transfer these resulting dataset (.csv) files from the mainframe to a place where the J2EE app can process (zip, encrypt, and place on file storage) the files.
So, finally to the question. As I understand MQ Series (Now MQ WebSphere or something like that), in essence it is a FIFO queue that can also provide triggering logic.
Is it possible to implement something that could monitor the MQ queue to just pull the files off the queue and process them? Or be triggered to check the MQ queue? Is this something already in the J2EE? Is this done via an api of some type? If this is possible, where is a good place to find some resources on doing something like this?
This is still in requirements and design so I don;t really have more detail at this point.
Thanks in advance for the help.
Re: Help a newbie with MQ
MQ has JMS support for J2EE, and MQJMS can read MQ messages sent by plain-old-MQ code (e.g. mainframe batch program).
For J2EE programming, you will need to look at message-driven beans. These will be called automatically for each message arriving on the associated MQ queue.
If the mainframe sends each message as text (using MQ format MQFMT_STRING or 'MQSTR') then they will appear in WebLogic as JMS TextMessages.
For WebLogic you will need to check the docs to see how MQ JMS is currently supported (i.e. as a non-WebLogic JMS provider).
Hope this gets you started.
Re: Help a newbie with MQ
> There is an option on the table to look at using MQ Series to
> transfer these resulting dataset (.csv) files from the mainframe to a
> place where the J2EE app can process (zip, encrypt, and place on file
> storage) the files.
The crucial point in your requirement is the word "file". MQ itself does
not work with files - it transfers (, stores, queues, variously
manipulates) *messages* between one program and another. So program A
will do (pseudocode-ish) "queue.put(dataBuffer);" and some time later
program B will do "incomingData = queue.get();". There are an almost
infinite number of variations and refinements of these two basic steps,
but at no time are files on disk involved.
Since you're building this from scratch, it may be that you should look
at replacing the "write a dataset" part of your mainframe step with "put
a message to MQ", typically one message per dataset record. Your J2EE
app can then pick up these messages (in its own time or invoked by MQ)
and do the necessary.
** OR **
As an alternative, you could consider MQ File Transfer Edition. Despite
the name, this isn't so much a modified version of MQ but a higher-level
application that sits on top of an MQ network. File Transfer Edition
*does* deal with files, and scripted movement and processing of files is
very much its bread and butter. It natively handles zOS datasets, and
transfers can be initiated at set times and/or based on the
presence/absence/size of a file. The commandline commands are designed
to be invoked from shell scripts or zOS JCL, but the "native" scripting
language for the application is Apache Ant. Processing integrated as
part of a transfer (before or after moving the files) can call any
(pre-permitted) executable program, or JCL on the mainframe, or Ant
scripts. One of the included sample scripts is to zip up and transfer a
If your mainframe step has to produce datasets as output, as opposed to
messages, then File Transfer Edition rather than straight MQ is probably
the way forward.