© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2023
A. S. BluckIBM Software Systems Integration https://doi.org/10.1007/978-1-4842-8861-0_3

3. IBM JMS Interface Development IBM FileNet 5.5.x Workflow

Alan S. Bluck1  
(1)
Ashley Heath, Hampshire, UK
 

This chapter describes an example development of a Java jar file for the IBM Java Messaging Service calls and its deployment for use in an IBM Case Manager Workflow. See https://doi.org/10.13140/RG.2.2.21708.16001.

For the installation steps required for IBM Case Manager 5.3.3, which are covered step by step in the following free ResearchGate documents, downloaded using the DOI URLs as follows:

entitled “Case Manager 5.3.3 Installation on RHEL 8.0 with Content Navigator 3.0.6”

Click the Download file PDF command button in Figure 3-1.

A screenshot of the case manager 5.3.3 installation page contains preprint, P D F available, and download file P D F options with the date, D O I, project, and author's detail.

Figure 3-1

Download the IBM Case Manager Installation Document

This gives the downloaded document, entitled CaseManagerInstallationonRHEL8.0_V3.docx.

Note

The Audit system is based on an article in the journal, Quality Forum, Volume 19 No. 3, September 1993. The Journal of the Institute of Quality Assurance. Pages 116–126. The Quality Audit Process, by Alan S. Bluck (https://www.researchgate.net/publication/334095565_Case_Manager_Solution_Development#fullTextFileCssontent).

This chapter includes the steps for the development of a prototype system component, with code working with a Test harness including the development of a process for deploying and testing an AUDOperations.jar CI (Component Integration) jar file for use in a Workflow system step.

The IBM MQ Series is installed on a Linux VMware and requires the latest Fix Packs. After installation, we describe the setup test queues and the configuration of a JNDI link using a Tivoli Directory Services LDAP for LDAP context lookup.

An IBM MQ server is an installation supporting one or more queue managers that provide message queuing services to one or more clients. All the IBM MQ objects, for example, queues, exist only on the queue manager server. The MQ client does not store any MQ Objects. An IBM MQ MQI client is available which allows an application running on one system server to communicate with a queue manager running on another system server.

Note

During development, it was found that the com.ibm.mq.jms.MQQueue cannot be cast to javax.jms.QueueConnectionFactory.

Chapter Organization

This chapter contains the following six Parts:

Part 1 – Bill of Materials. This Part lists the prerequisite IBM Software components, including the IBM product code numbers, required to download the latest IBM MQ Series software components, used to test the Java JMS message service API calls. It also covers the installation of the downloaded software on a Red Hat Linux server.

Part 2 – Custom Operations Component Development. The Custom Operations Component is defined in the subscribed Workflow as a special Component Integrator step, which we will describe in this Part.

Part 3 – Creating a Non-privileged MQ User for a Client Application Connection. This Part describes a procedure to create a non-privileged user ID to be used for a client application which connects to the queue manager. Access is granted for the client application only to be able to use the channel it needs and the queue it needs by use of this user ID.

Part 4 – Second Run of the AUDOperationsTest.java JUnit for JMS Messaging. This Part covers the second run of the JUnit test, which is more successful. The console screen output shown in Figure 3-232 is from the Eclipse IDE JUnit run of the AUDOperationsTest.java Class.

This shows the transmission of a test message to the IBM MQ Connection Factory, AUDCF3 queue, and the retrieval of the ten Audit Documents in the output list from the Audit Master Case Manager solution, Target Object Store.

Part 5 – Building the AUDOperations.jar. This Part describes the method for exporting the Java program in the AUDOperations.jar file with the exposed methods we wish to call from our IBM Process Designer Workflow.

Part 6 – Transferring Workflow and Setting Up Workflow Subscriptions. In this Part, the Target Object store, OS2, is updated with a Workflow Definition document class (AUD_JMSMessage.pep file), which is used to run the Workflow we created, triggered by a new Audit Report document created in the Target Object store from an Audit Master solution Case Manager Audit Department Case. The acce web Administration console is used to create the required Workflow Subscription.

Part 1 – Bill of Materials

The following URL link describes the latest available IBM MQ Series 9.x downloads and provides links to the versions of IBM MQ available for download:

www.ibm.com/docs/en/ibm-mq/9.2?topic=roadmap-mq-downloads

The next link displays the available pdf documentation for IBM MQ:

www.ibm.com/docs/en/ibm-mq/9.2?topic=am-mq-92-pdf-files-product-documentation-program-directories

The hardware and software requirements for IBM MQ series are described at this URL link:

www.ibm.com/support/pages/node/318077

An overview of the installation procedure for IBM MQ 9.2 can be seen at this link:

www.ibm.com/docs/en/ibm-mq/9.2?topic=uninstalling-installing-mq-linux

The development of a Java JMS message queue for Linux, Windows, and IBM Cloud is described in the following link:

https://developer.ibm.com/tutorials/mq-develop-mq-jms/

The IBM MQ Series Version 9.2 for Continuous Deployment full installation requires 2010 MBytes of disk space. This version is now released as a Continuous Delivery (CD) package offer with regular update packages. Each update incrementally delivers new capability and defect fixes (compared with Long-Term Support (LTS) packages which just receive security and defect fixes through fix packs and individual fixes with no incremental functional enhancements).

A screenshot of the product details window contains file name, platforms, languages, estimated download duration, file size, connection, download director, and H T T P transfer details.

Figure 3-2

Product details of the IBM MQ 9.2.4 Linux version including download times

The version and product code details for the installations are as follows:

IBM SDK, Java (TM) Technology Edition, Version 8 for Linux (CND18ML)

IBM MQ V9.2.5 Continuous Delivery Release for Windows 64-bit Multilingual (M0458ML)

IBM MQ V9.2.x Continuous Delivery Quick Start Guide (G014JML)

IBM MQ V9.2.5 Continuous Delivery Release for Linux on x86 64-bit Multilingual (M0454ML)

A screenshot of the product details page contains the I B M M Q V 9.2.5 installation packages with their view details, license agreement, download estimate, and e-assembly options with checkboxes. The first and last packages are highlighted.

Figure 3-3

Product details for the download of the IBM MQ V9.2.5 installation packages

A screenshot of a dialog box containing I agree and I do not agree radio buttons with the terms and conditions given below. There is a download now option at the bottom.

Figure 3-4

The “I agree” radio button option is selected for the packages required

A screenshot of the I B M download director app window contains the download progress bar with details of the file location, size, total size, time remaining, connections, and options for pause, setup, details, and cancel.

Figure 3-5

The progress status bar window of IBM Download Director shows the download progress of the IBM_MQ_9.2.5_LINUX_X86-64.tar.gz

A screenshot of the details download director window contains the details of 2 files under state, date, size, and name with radio buttons for the current download and download history. There are options for details and refresh below them.

Figure 3-6

The details of the downloaded packages are displayed

The preceding downloads are for the Linux version of IBM MQ Version 9.2.5, which we will show how to install and configure later in this chapter.

A screenshot has 2 parts. The top part contains the view details, license agreement, download estimate, and e assembly options with the highlighted checkbox for I B M M Q V 9.2.5 Windows 64-bit file. The bottom part contains the I agree and I do not agree radio buttons with the terms and conditions and a download now option.

Figure 3-7

The Windows 64-bit version of IBM MQ V9.2.5 Continuous Delivery Release is selected for download

The Windows version of IBM MQ V9.2.5 is selected for download.

A screenshot of the do you want to run this application dialog box contains the name, publisher, and location details with the java applet icon on the left. The run and cancel buttons are given below.

Figure 3-8

The Download Director Java applet is run in a Firefox browser

A screenshot of the I B M download director app window contains the download progress bar with details of the file location, size, time remaining, connections and options for pause, setup, details, and cancel.

Figure 3-9

The download status of the IBM_MQ_9.2.5_WINDOWS.zip file is shown

The Details command button in Figure 3-9 shows the date and size of the downloaded installation file for IBM MQ version 9.2.5 for Windows.

A screenshot of the details download director window contains the details of a file under state, date, size, and name with radio buttons for current download and download history. There are options for details and refresh below them.

Figure 3-10

The downloaded IBM_MQ_9.2.5_WINDOWS.zip installation file

  1. 1)
    First, we create the /home/IBM/MQ directory logged in as the root user:
    cd /home
    mkdir IBM
    cd IBM
    mkdir MQ
    cd MQ
     
  2. 2)
    Copy the IBM_MQ_9.2.5_LINUX_X86-64.tar.gz file to the /home/IBM/MQ folder path created using wasadm on the ecmukdemo6 server:
    cp /mnt/hgfs/Installs/MQ/IBM_MQ_9.2.5_LINUX_X86-64.tar.gz .
     
  3. 3)
    The IBM MQ 9.2.5 installation is unpacked, and then we change to the MQServer subfolder:
    tar -zxvf IBM_MQ_9.2.5_LINUX_X86-64.tar.gz
    cd /home/IBM/MQM/MQServer
     
  4. 4)
    The license is registered using the following shell script:
    ./mqlicense.sh -text_only
     
Note

From IBM MQ 9.2.0, you have the option of accepting the license before or after installing the product. To accept the license before installing, run the mqlicense.sh script first.

Press Enter to continue viewing the license agreement, or enter “1” to accept the agreement, “2” to decline it, “3” to print it, “4” to read non-IBM terms, or “99” to go back to the previous screen.

1

This returns the message:
Agreement accepted:  Proceed with install.

A screenshot of the root at M Q server window contains the server and licensed materials information with descriptions of notice and important read carefully.

Figure 3-11

The License shell script is run

  1. 5)
    The temporary environment variable used for installation is set as follows:
    mkdir /opt/IBM/software/
    mkdir /opt/IBM/software/tmp
    TMPDIR=/opt/IBM/software/tmp
     
  2. 6)

    The rpm command is used to install the packages:

     
rpm -ivh MQSeries*.rpm

The preceding command causes the default directory path to be used.

The default location /opt/mqm is selected with the rpm -ivh command. The preceding command will install all components that are available in the current location on the installation media to the default location.
(base) [root@ECMUKDEMO6 MQServer]# mkdir /opt/IBM/software/
(base) [root@ECMUKDEMO6 MQServer]# mkdir /opt/IBM/software/tmp
(base) [root@ECMUKDEMO6 MQServer]# TMPDIR=/opt/IBM/software/tmp
(base) [root@ECMUKDEMO6 MQServer]# rpm -ivh MQSeries*.rpm
warning: MQSeriesAMQP-9.2.5-0.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0209b828: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Creating group mqm
Creating user mqm
Updating / installing...
   1:MQSeriesRuntime-9.2.5-0          ################################# [  3%]
   2:MQSeriesJRE-9.2.5-0              ################################# [  6%]
   3:MQSeriesJava-9.2.5-0             ################################# [  9%]
   4:MQSeriesFTBase-9.2.5-0           ################################# [ 12%]
   5:MQSeriesGSKit-9.2.5-0            ################################# [ 15%]
   6:MQSeriesServer-9.2.5-0           ################################# [ 18%]
Updated PAM configuration in /etc/pam.d/ibmmq
WARNING: System settings for this system do not meet recommendations for this product
         See the log file at "/tmp/mqconfig.43911.log" for more information
   7:MQSeriesFTAgent-9.2.5-0          ################################# [ 21%]
   8:MQSeriesFTService-9.2.5-0    ################################# [ 24%]
Licensed entitlement 'advanced' set for installation at '/opt/mqm'.
   9:MQSeriesAMQP-9.2.5-0             ################################# [ 26%]
  10:MQSeriesAMS-9.2.5-0              ################################# [ 29%]
Licensed entitlement 'advanced' set for installation at '/opt/mqm'.
  11:MQSeriesFTLogger-9.2.5-0     ################################# [ 32%]
  12:MQSeriesWeb-9.2.5-0              ################################# [ 35%]
  13:MQSeriesXRService-9.2.5-0   ################################# [ 38%]
Licensed entitlement 'advanced' set for installation at '/opt/mqm'.
  14:MQSeriesClient-9.2.5-0          ################################# [ 41%]
  15:MQSeriesFTTools-9.2.5-0         ################################# [ 44%]
  16:MQSeriesBCBridge-9.2.5-0      ################################# [ 47%]
  17:MQSeriesSFBridge-9.2.5-0      ################################# [ 50%]
  18:MQSeriesExplorer-9.2.5-0      ################################# [ 53%]
  19:MQSeriesMan-9.2.5-0           ################################# [ 56%]
  20:MQSeriesMsg_cs-9.2.5-0        ################################# [ 59%]
  21:MQSeriesMsg_de-9.2.5-0        ################################# [ 62%]
  22:MQSeriesMsg_es-9.2.5-0        ################################# [ 65%]
  23:MQSeriesMsg_fr-9.2.5-0        ################################# [ 68%]
  24:MQSeriesMsg_hu-9.2.5-0        ################################# [ 71%]
  25:MQSeriesMsg_it-9.2.5-0        ################################# [ 74%]
  26:MQSeriesMsg_ja-9.2.5-0        ################################# [ 76%]
  27:MQSeriesMsg_ko-9.2.5-0        ################################# [ 79%]
  28:MQSeriesMsg_pl-9.2.5-0        ################################# [ 82%]
  29:MQSeriesMsg_pt-9.2.5-0        ################################# [ 85%]
  30:MQSeriesMsg_ru-9.2.5-0        ################################# [ 88%]
  31:MQSeriesMsg_Zh_CN-9.2.5-0     ################################# [ 91%]
  32:MQSeriesMsg_Zh_TW-9.2.5-0     ################################# [ 94%]
  33:MQSeriesSamples-9.2.5-0       ################################# [ 97%]
  34:MQSeriesSDK-9.2.5-0           ################################# [100%]
(base) [root@ECMUKDEMO6 MQServer]#
Listing 3-1

The installation list of IBM MQ Series 9.2.5.0 components

A screenshot of a window contains the m q config settings information for system V semaphores, system V shared memory, system settings, and current user limits with their pass and fail status. It also has the descriptions of m q config below.

Figure 3-12

The current root User file limits are displayed as FAIL

The current root User limits need to be increased!

nofile (-Hn) 4096 files

and nofile (-Sn) 1024 files

These two limits need to be increased to 10240.

The root user limits can be changed as follows:

vi /root/.bashrc

ulimit -u unlimited

Also, the settings in /etc/security/limits.conf need to be edited.

Log in to the computer as the root user or as a user with sudo permissions.

Go to the /etc/security directory.

Open the limits.conf file for editing.

Add the following lines to the file:
@root soft nofile 10240
@root hard nofile 16384
* soft nofile 10240
* hard nofile 16384

Save and close the file.

Restart the computer for the changes to take effect.

A cropped screenshot of a window contains the file details under domain, type, item, and value to fix the limits failure.

Figure 3-13

The /etc/security/limits.conf file is edited to fix the Limits FAIL

Note

After changing the limits, the ecmukdemo6 system requires a reboot.

Set the MQ Series as the primary installation:
cd /opt/mqm/bin
/opt/mqm/bin/setmqinst -i -p /opt/mqm

147 of 147 tasks have been completed successfully.

‘Installation1’ (/opt/mqm) set as the primary installation.
(base) [root@ECMUKDEMO6 bin]#

A cropped screenshot of a window gives the 147 of 147 tasks have been completed successfully, and Installation 1 set as the primary installation message for a file with various codes.

Figure 3-14

The /etc/security/limits.conf file is edited to fix the Limits FAIL

  1. 7)

    env gives the following MQ-related environment variables.

     
(base) [root@ECMUKDEMO6 mqm]# . /opt/mqm/bin/setmqenv -s
(base) [root@ECMUKDEMO6 mqm]# env
MQ_INSTALLATION_NAME=Installation1
HOSTNAME=ECMUKDEMO6
OLDPWD=/opt/mqm/bin
CLASSPATH=/opt/mqm/java/lib/com.ibm.mq.jar:/opt/mqm/java/lib/com.ibm.mqjms.jar:/opt/mqm/java/lib/com.ibm.mq.allclient.jar:/opt/mqm/samp/wmqjava/samples:/opt/mqm/samp/jms/samples
MQ_INSTALLATION_PATH=/opt/mqm
PWD=/opt/mqm
HOME=/root
MQ_JAVA_INSTALL_PATH=/opt/mqm/java
MQ_DATA_PATH=/var/mqm
MQ_JAVA_DATA_PATH=/var/mqm
MANPATH=/opt/mqm/man:/usr/share/man
MQ_ENV_MODE=64
MQ_JRE_PATH=/opt/mqm/java/jre64/jre
PATH=/opt/mqm/bin:/root/miniconda3/bin:/root/miniconda3/condabin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/opt/GO/go/bin:/root/.dotnet/tools:/root/bin:/opt/GO/go/bin
MQ_JAVA_LIB_PATH=/opt/mqm/java/lib64
(base) [root@ECMUKDEMO6 mqm]#
Listing 3-2

The MQ-related environment variables

  1. 8)

    Launch the MQ Explorer.

     

A cropped screenshot of a window has the codes that load the M Q explorer program.

Figure 3-15

The MQ Explorer program is loaded

  1. 9)

    The MQ Explorer GUI is shown in Figure 3-16.

     

A screenshot of the I B M M Q explorer window has the welcome to M Q explorer message with its description on the right. The M Q explorer navigator panel on the left contains the I B M M Q parent folder with 5 sub-folders.

Figure 3-16

The IBM MQ Explorer GUI is displayed using ./MQExplorer

Note

The message displayed in Figure 3-16:

With this installation, existing local queue managers are displayed automatically in the Navigator view. However, the current user is not a member of the 'mqm' group and is therefore not authorized to use MQ control commands. The user will not be able to perform local queue manager operations such as create, start, stop and delete. To add a remote queue manager, right-click ‘Queue Managers’, and select ‘Add Remote Queue Manager’.

  1. 10)

    So, we must add wasadm as a member of the mqm group:

     
usermod -a -G mqm wasadm
Add mqm to the mqm group:
usermod -a -G mqm mqm
Note

This must be done for the mqm user; otherwise, the wasadm Q Manager create will fail with an error message.

  1. 11)

    Log out and then log back in as wasadm for the changes to take effect.

     

A screenshot of the log out root dialog box contains the cancel and log out options. The text above the options read, root will be logged out automatically in 60 seconds.

Figure 3-17

The Linux root user is logged out

We need to switch to log in to the wasadm Linux user.

A screenshot of a window contains 8 user names with the not listed option and red hat logo at the bottom. The user name w a s a d m is highlighted.

Figure 3-18

The wasadm Linux user is selected for login

A screenshot of a window contains the entered password in asterisk marks for the user w a s a d. It has the option of cancel and sign in at the bottom.

Figure 3-19

The wasadm password is entered in the Linux Desktop

After installation of IBM MQ Series 9.2.5, there is a Linux Desktop icon installed which can be searched in the Activities Desktop search, as shown in Figure 3-20, and will then launch the IBM MQ Series 9.2.5 administration application, IBM MQ Explorer.

A screenshot of a window contains a search box with the text I B M M Q explorer and the I B M M Q explorer program icon highlighted below.

Figure 3-20

The IBM MQ Explorer 9.2.5 program icon to be clicked

A screenshot of the splash screen of I B M M Q version 9.2. It has an I B M logo on the top right, and the built on eclipse and java logos at the bottom.

Figure 3-21

The splash screen of the IBM MQ Series Version 9.2.5 Explorer

  1. 12)

    Now displays:

     

A screenshot of the I B M M Q explorer window has the welcome to M Q explorer message with its description on the right. The M Q explorer navigator panel on the left contains the I B M M Q parent folder with 5 sub-folders.

Figure 3-22

The initial screen of the IBM MQ Series Version 9.2.5 Explorer

With this installation, existing local queue managers are displayed automatically in the Navigator view. To create a new local queue manager, right-click Queue Managers, and select NewQueue Manager. To add a remote queue manager, right-click Queue Managers, and select Add Remote Queue Manager.

A cropped screenshot of the I B M M Q explorer window has the M Q explorer navigator panel with an options menu for the sub-folder queue manager. It has the new option in the options menu, and the queue manager option in the sub-menu highlighted.

Figure 3-23

A New local Queue Manager is created using the highlighted menus

  1. 13)

    Create a Queue Manager.

     

A screenshot of the create queue manager window has the input boxes for queue manager name, default transmission queue, dead-letter queue, max handle unit, trigger interval, max uncommitted messages, and application group. The checkbox to make this the default queue manager is highlighted with options for back, next, cancel, and finish given below.

Figure 3-24

The wasadm Queue Manager is created with Group mqm

  1. 14)

    Defaults are used for logging.

     

A screenshot of the create queue manager window has the input box for queue manager name with the radio buttons for use circular and linear logging, and options for log file size, log primary files, and log secondary files. The options for data and log paths and back, next, cancel, and finish are given below.

Figure 3-25

The Queue Manager Logging defaults are used, and Next> is clicked

  1. 15)

    Click Next> and select Permit a standby instance (tick box) and remote admin by Create server-connection channel (tick box) to allow remote.

     

A screenshot of the create queue manager window has the input box for queue manager name with the checkboxes for start queue manager, multi-instance queue manager, and create server-connection channel highlighted. The options for automatic configuration and back, next, cancel, and finish are given below.

Figure 3-26

The required Queue Manager options are ticked as highlighted

Note

From IBM MQ 9.2.0, you can configure your queue manager to automatically apply the contents of an MQSC script, or set of MQSC scripts, on every queue manager start. (This is also available from version 9.1.4 onward.)

(See www.ibm.com/docs/en/ibm-mq/9.2?topic=commands-automatic-configuration-from-mqsc-script-startup.)

The following link contains an example configuration:

www.ibm.com/docs/en/ibm-mq/9.2?topic=manager-example-supplying-mqsc-ini-files
  1. 16)

    Click Next>.

     

A screenshot of the create queue manager window has the input box for queue manager name with the checkbox for create listener configured for T C P I P. The options for listen on port number and back, next, cancel, and finish are given below.

Figure 3-27

The Create listener configured for TCP/IP is ticked with port 1414

  1. 17)

    Use the default port 1414 and click Next>.

     

A screenshot of the create queue manager window has the input box with the w a s a d m queue manager name and the checkboxes for auto-reconnect and automatically refresh information. The options for interval in seconds, apply default, and back, next, cancel, and finish are given below.

Figure 3-28

The wasadm Queue Manager reconnection settings are entered

  1. 18)

    Use a default 15-second refresh interval, click Apply Default, and click Finish.

     
  2. 19)

    Queue Manager is now created.

     

A screenshot of the I B M M Q explorer window has the queue managers' information for w a s a d m on the right. The M Q explorer navigator panel on the left has the queue manager sub-folder selected.

Figure 3-29

The newly created wasadm Queue Manager is now displayed

  1. 20)

    Click the wasadm node to show the status of the Queues created.

     

A screenshot of the I B M M Q explorer window has the queue manager w a s a d m information on connection overview, status quick view, and properties quick view on the right. The platform and Unix are selected under properties quick view. And the M Q explorer navigator panel on the left has the w a s a d m node selected.

Figure 3-30

The status of the Queue Manager is displayed at the wasadm node

Notification of Successful Document Load into the FileNet Target Object Store OS2

JMS MQ Java Message from Content Object Store OS2, FileNet

An event will be created in FileNet to send a real-time MQ message to the Quality Audit Database system, auditdb, when a new Audit Report Task Workflow is created.

This message will pass back the following metadata. Timestamps will be generated as part of the messaging service:

Field ID

Attributes

Case ID

 

Department Id

 

AuditDate

CCYY-MM-DD-HH.MM.SSSSSS

Audit Report Id

 

Preconditions

An Audit Report document has been successfully loaded and stored in the FileNet Target (OS2) Object Store.

Postconditions

A message containing the relevant information to identify the Department and the Audit Report Document will be placed on MQ, and an email alert will be issued from the Workflow operation system step to the Department manager.

Exceptions

If MQ messages fail due to Audit Case processing issues or MQ being unavailable, the load of any new documents may be paused for a limited time period until the root cause of the issues is identified.

Controls will be implemented where necessary to prevent a flood of MQ messages causing performance issues where a larger than normal volume of documents is processed (i.e., from a backlog following a Document load failure).

Set up point-to-point messaging using queues. Configuring the application and the messaging system requires the following steps:
  1. 1.

    Add initial JMS Context.

     

A cropped screenshot has the J M S administered objects folder selected on the left panel. It has the options menu with add initial context option highlighted.

Figure 3-31

The Initial JMS Content is added

The Add Initial Context is used to select an LDAP server for the JNDI namespace.

A screenshot of the add initial context window has the connection details, with the where is the J N D I namespace located, radio buttons. The options for J N D I service provider, namespace location and back, next, cancel, and finish are given below.

Figure 3-32

The JNDI namespace is selected to be on the ecmukdemo6 LDAP server

A screenshot of the add initial context window has the security configuration details, with the J N D I service provider security drop-down menu. The options for back, next, cancel, and finish is given below.

Figure 3-33

The drop-down shows the types of security configuration available

The choices are as follows:
  • None: The JNDI service provider does not require authentication. MQ Explorer connects to the initial context using anonymous authentication, and no security credentials are passed to the JNDI service provider.

  • Simple: The JNDI service provider requires simple authentication. MQ Explorer must pass the user-distinguished name and password to the JNDI service provider to connect to the initial context. (We select this option.)

  • CRAM MD5: The JNDI service provider requires CRAM-MD5 authentication. MQ Explorer must pass the MD5-encrypted password to the JNDI service provider to connect to the initial context.

Tick the option to Automatically reconnect to context on startup.

A screenshot of the add initial context window has the user preferences details, with the context nickname input box and connect immediately, automatically reconnect checkboxes. The options for back, next, cancel, and finish are given below.

Figure 3-34

The option to Automatically reconnect to context on startup is ticked

Click the Finish command button.

Enter the user as cn=root (password =filenet) for logging into the LDAP as an administrative user.

A screenshot of the security credentials dialog box in add initial context window has the input boxes for user D N and password. The options for cancel and O K are given below.

Figure 3-35

The LDAP administrative username and password are entered

A screenshot of the I B M M Q explorer window has the J M S administered objects information on the right. The M Q explorer navigator panel on the left has the J M S administered objects sub-folder selected.

Figure 3-36

The status of the JMS LDAP Server Context is displayed as Connected

Clicking the JMS Administered Objects ldap node loads the LDAP users and groups.

A screenshot of the I B M M Q explorer window has the M Q explorer content information for initial context on the right. The M Q explorer navigator panel on the left has the L D A P server U R L selected.

Figure 3-37

The opener for the LDAP server URL displays the Users and Groups

Create a new test Local queue, AUDQAR.

A cropped screenshot of the I B M M Q explorer window has the M Q explorer navigator panel with an options menu for the sub-folder Queues. It has the new option in the options menu, and the local queue option in the sub-menu highlighted.

Figure 3-38

The new AUDQAR Local Queue is created

The new Local Queue is named AUDQAR, and the Start wizard option is ticked to launch the LDAP JMS Queue Context to match the new local Queue.

A screenshot of the new local queue window has the create a local queue detail, with the name input box, option to select an existing object, and a start wizard checkbox. The options for back, next, cancel, and finish is given below.

Figure 3-39

The new Local Queue is named AUDQAR and Finish clicked

Click Select.

A screenshot of the select the like object dialog box in new local queue window has the filter and scheme option selected as standard for queues. The system default local queue under queue name is highlighted. And the options for cancel and O K are given below.

Figure 3-40

The SYSTEM.DEFAULT.LOCAL.QUEUE option is selected from the list

Click OK on SYSTEM.DEFAULT.LOCAL.QUEUE.

Tick the “Start wizard to create a matching JMS Queue” and click Next>.

A screenshot of the new local queue window has the change properties detail, with the general option selected from the left panel. It has input boxes and options for queue name, type, description, put messages, get messages, default priority, default persistence, and scope. The options for back, next, cancel, and finish is given below.

Figure 3-41

Enter the Queue name and click Finish

Click Finish.

A screenshot of the I B M M Q explorer dialog box in new local queue window gives the object was created successfully message. It has a checkbox for do not show success messages in future. The option for O K is given below.

Figure 3-42

The status of the Queue object creation is displayed

Click OK.

A screenshot of the new destination window has the new J M S queue detail, with the select box for J M S context. The options for back, next, cancel, and finish is given below.

Figure 3-43

The JMS Queue wizard requires the JMS Context to be selected

The JMS Queue wizard is invoked.

Click Select.

A screenshot of the select the J M S context dialog box in new destination window has an U R L selected. The options for O K and cancel are given below.

Figure 3-44

The LDAP server is highlighted; click OK

A screenshot of the new destination window has the new J M S queue detail, with an U R L in the select box for J M S context. The options for back, next, cancel, and finish is given below.

Figure 3-45

The JMS Context shows our LDAP server

Click Next>.

A screenshot of the new destination window has the create a destination detail, with an input box and options for name, messaging provider, and type. The options for back, next, cancel, and finish is given below.

Figure 3-46

The Audit Queue Context Factory name is entered as AUDQCF; click Next

The AUDQCF (Audit Queue Context Factory) object name is entered.

A screenshot of the new destination window has the create a destination detail, with an input box, checkbox, and options for name, create with attributes, and select an existing object. A property values table below has quea ue and A U D Q A R selected. The options for back, next, cancel, and finish are given below.

Figure 3-47

The AUDQCF queue name is displayed

Click Next.

A screenshot of the new destination window has the change properties detail, with the general option selected from the left panel. It has input boxes and options for name, description, class name, messaging provider, queue manager, and queue. The options for back, next, cancel, and finish is given below.

Figure 3-48

The AUDQCF properties are displayed. Click Finish to create the JMS Queue

Click Finish.

A screenshot of the I B M M Q explorer dialog box in new destination window gives the object was created successfully message. It has a checkbox for do not show success messages in future. The option for O K is given below.

Figure 3-49

The AUDQCF JMS Queue Context Factory queue status shows it was created

Click OK.

The JMS Queue is now created.

A screenshot of the I B M M Q explorer window has the M Q explorer content information for initial context on the right. The M Q explorer navigator panel on the left has the L D A P server U R L selected.

Figure 3-50

The AUDQCF queue is now visible as a JMS MQQueue class JNDI Object

Test the Queue Message service.

A cropped screenshot of the I B M M Q explorer window has the M Q explorer navigator panel on the left with the sub-folder Queues selected. The M Q explorer content tab on the right has the queues detail with the put test message and browse messages options from the options menu highlighted for A U D Q A R.

Figure 3-51

The AUDQAR Queue is tested using the highlighted menu options

The test message is entered, and the Put message command is clicked.

A screenshot of the put test message window has the input boxes detail for queue manager, queue, and message data. The options for put message and close are given below.

Figure 3-52

The test message is created and the Put message command clicked

A screenshot of the put test message window has the input boxes detail for queue manager, queue, and message data. The options for put message and close are given below.

Figure 3-53

The browse message shows the transferred test message

The test message is also sent in XML form as shown in Figure 3-53.

A screenshot of the message browser window has the queue manager name, queue name, and scheme with a table that has the first test message. The options for refresh and close are given below.

Figure 3-54

The first test message for the AUDQAR queue

The message can be seen in the queue using the Browse Message function.

A cropped screenshot of the message browser window has the options menu for the first test message. The option for properties from the menu is highlighted.

Figure 3-55

The Properties menu item is clicked to display the test message data from the AUDQAR queue

A screenshot of the message 1 properties window has data selected from the left panel. It has the input boxes detail for total length, data length, format, coded character set identifier, encoding, message data, and message data bytes. The option for close is given below.

Figure 3-56

The Data Property of Message 1 displays the expected put message data

The JMS MQ series queue is now set up ready to be processed.

The following link shows a simplified architecture diagram:

www.ibm.com/docs/en/ibm-mq/9.3?topic=messaging-example-single-queue-manager-publishsubscribe-configuration

Part 2 – Custom Operations Component Development

A Workflow step can be used to call the sendJMSMessage Java method we develop, by using a Code Module .jar library imported as a CodeModule Document Class and then exposing this custom sendJMSMessage method by triggering the Workflow using a Workflow Subscription object, which can be linked to a Document Create Event object reference triggered on the creation of an Audit Report Document class.

The Custom Operations Component is defined in the subscribed Workflow as a special Component Integrator step, which we will describe in this Part.

First, log out as the wasadm user and log in as root.
cd /root/eclipse/java-2021-12/eclipse
./eclipse

A screenshot of the eclipse I D E launcher window has the select a directory as workspace detail, with options for select a workspace and browse. A checkbox to use this as the default and do not ask again is given below with the options for cancel and launch.

Figure 3-57

The Eclipse Java IDE is launched with the default Workspace

There are a number of links to code examples which are the basis for the IBM Content Engine and Process Engine Workflow component steps, which can be found on GitHub:

https://github.com/ibm-ecm/ibm-content-platform-engine-samples

The following IBM License is displayed in the code samples I have used in this book:

https://github.com/ibm-ecm

See the link here for the Java code examples used as a basis for this section.
Licensed Materials - Property of IBM (c) Copyright IBM Corp. 2019 - 2021 All Rights Reserved.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
DISCLAIMER OF WARRANTIES:
Permission is granted to copy and modify this Sample code, and to distribute modified versions provided that both the copyright notice, and this permission notice and warranty disclaimer appear in all copies and modified versions.
THIS SAMPLE CODE IS LICENSED TO YOU AS-IS. IBM AND ITS SUPPLIERS AND LICENSORS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, IN SUCH SAMPLE CODE, INCLUDING THE WARRANTY OF NON-INFRINGEMENT AND THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL IBM OR ITS LICENSORS OR SUPPLIERS BE LIABLE FOR ANY DAMAGES ARISING OUT OF THE USE OF OR INABILITY TO USE THE SAMPLE CODE, DISTRIBUTION OF THE SAMPLE CODE, OR COMBINATION OF THE SAMPLE CODE WITH ANY OTHER CODE. IN NO EVENT SHALL IBM OR ITS LICENSORS AND SUPPLIERS BE LIABLE FOR ANY LOST REVENUE, LOST PROFITS OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, EVEN IF IBM OR ITS LICENSORS OR SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

The following DemoJava.zip download link contains the code for the core connection Java for links to the IBM MQ Series JMS Queues:

www.ibm.com/support/pages/filenet-content-engine-java-api-demo-sample-code

A screenshot of the I B M webpage has the I B M support tab for File Net Content Engine Java A P I Demo Sample Code with a search bar and descriptions for abstract and download. The file Demo Java dot zip is highlighted below.

Figure 3-58

The DemoJava.zip link highlighted downloads the sample Java

The base Java code examples are downloaded from the link in Figure 3-58, and the DemoJava.zip file is unpacked to the DemoJava folder.

A screenshot of the contents of a folder has a Demo Java sub-folder, and the Demo Java dot zip file highlighted.

Figure 3-59

The example Java source code is unpacked to a DemoJava subfolder

In Eclipse, copy the sample Java components, and edit to a new Java AUD_CIOps project (this time, we deselected the module name option).

A screenshot of the new java support window has the java settings detail, with source options, details options, a checkbox to allow output folders, and an option to browse default output folder. The options for back, next, cancel, and finish is given below.

Figure 3-60

The new AUD_CIOps project is created clicking Finish

See also Chapter 2, in the start of the section “Configuring Java Components for Content Engine Events,” to see the step-by step screenshots and procedure for creating a new Eclipse Java Project.

This Component Integrator code component is described in overview in the IBM Documentation:

www.ibm.com/docs/en/filenet-p8-platform/5.5.x?topic=tools-component-integrator

and in more detail with the following link:

“Developing Component Integrator-Based Work Performers – IBM Documentation

www.ibm.com/docs/en/filenet-p8-platform/5.5.x?topic=performers-developing-component-integrator-based-work

The following IBM Technote has a link to a downloadable pdf document, which describes changes in the deployment for the Component Integrator Java libraries, into the Component Manager, which were introduced in the IBM FileNet P8 5.2 Component Manager version.

See www-01.ibm.com/support/docview.wss?uid=swg27043131.

From this downloaded pdf document, Migrating to the 5.2 Component Manager.pdf, it should be noted that the JAR files are added to the object store as a code module, as we described for the Event Handler Java library in Chapter 2. It is also recommended that either the JAR file is stored as a separate content element (since the code module is a versionable object, and JAR files can be added, removed, and updated as required), where the same code module Object can be used by more than one component queue, or, as IBM recommends, that the best practice is to use a separate code module for each component queue.

Creating the AUD_CIOps Java Project

The new Java Project is created as AUD_CIOps.

The Package and Class outlines used are as follows.
Package: com.ibm.filenet.ps.ciops
Class AUDOperations (void)
==========================
Variables:
JMSsession: Session
JMSconnection: Connection
connFactory:ConnectionFactory
messageString: String
dLookup: String
logger: Logger
session: Session
connection: Connection
Methods
=======
AUDOperations() (Constructor)
getConnection():Connection
getVWSession():VWSession
getDatabaseConnection(): Connection
getFolderFromAttachment(VMAttachment):Folder (Private)
getDocumentFromAttachment(VWAttachment): VWAttachment[]:Document (Private)
getObjectStore(String):ObjectStore (Private)
getFolderDocuments(VWAttachment):VWAttachment[] (Public)
getContainedDocuments(Folder):DocumentSet (Private)
getContainedDocumentsPropertyFilter():PropertyFilter (Private)
getAsVWAttachment(Document):VWAttachment (Private)
sendJMSMessage(VWAttachment,String):void (Public)
putMsg(Destination,String):void (Private)
Listing 3-3

The specification for the AUDOperations Component Integrator code module

The code for the CELoginModule Class, working at FileNet P8 5.5.x, is listed at the following link:

www.ibm.com/docs/fr/filenet-p8-platform/5.5.x?topic=performers-celoginmodule-class

A Jar file is created to test the base compilation and functionality.

The Java code created is as follows.
package com.ibm.filenet.ps.ciops;
import java.security.AccessController;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Set;
//JMS packages
import javax.jms.*;
import javax.naming.*;
import javax.naming.directory.*;
import java.util.Hashtable;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.naming.Context;
import javax.naming.directory.InitialDirContext;
import javax.naming.ldap.InitialLdapContext;
import javax.security.auth.Subject;
import com.filenet.api.collection.DocumentSet;
import com.filenet.api.constants.PropertyNames;
import com.filenet.api.core.Connection;
import com.filenet.api.core.Document;
import com.filenet.api.core.Domain;
import com.filenet.api.core.EntireNetwork;
import com.filenet.api.core.Factory;
import com.filenet.api.core.Folder;
import com.filenet.api.core.ObjectStore;
import com.filenet.api.property.FilterElement;
import com.filenet.api.property.PropertyFilter;
import com.ibm.filenet.ps.ciops.database.DatabasePrincipal;
import com.ibm.mq.MQC;
import com.ibm.mq.MQEnvironment;
import com.ibm.mq.MQMessage;
import com.ibm.mq.MQPutMessageOptions;
import com.ibm.mq.MQQueueManager;
import com.ibm.mq.constants.CMQC;
import com.ibm.mq.constants.MQConstants;
import com.ibm.mq.jms.MQConnectionFactory;
import com.ibm.mq.jms.MQQueue;
import filenet.vw.api.VWAttachment;
import filenet.vw.api.VWAttachmentType;
import filenet.vw.api.VWException;
import filenet.vw.api.VWLibraryType;
import filenet.vw.api.VWSession;
import filenet.vw.base.logging.Logger;
//Import JMS related packages
/**
* Alan S. Bluck - 26th June 2022
* AUD JMS Message sender Component Integrator code for AUDOperations
*
*
*/
public class AUDOperations {
    javax.jms.Session JMSsession =  null;
    javax.jms.Connection JMSconnection = null;
    javax.jms.ConnectionFactory  connFactory  = null;
    String messageString = null;
    String dLookup     = "cn=AUDQAR"; // Generic JMS Destination
        private static Logger logger = Logger.getLogger( AUDOperations.class );
    //JMS Variables
      static              Session    session     = null; // JMS Session
      static              Connection connection  = null; // JMS Connection
      public AUDOperations() {
          //java.sql.Connection databaseConnection = getDatabaseConnection();
          //if ( databaseConnection != null ) {
          //     logger.debug( databaseConnection.toString() );
          //} else {
               logger.debug( "No database connection" );
          //}
     }
     protected Connection getConnection() {
          String uri = System.getProperty("filenet.pe.bootstrap.ceuri");
          return Factory.Connection.getConnection(uri);
     }
     protected VWSession getVWSession() throws VWException {
          String connectionPoint = System.getProperty("filenet.pe.cm.connectionPoint");
          return new VWSession(connectionPoint);
     }
     protected java.sql.Connection getDatabaseConnection() {
          Subject subject = Subject.getSubject( AccessController.getContext() );
          Set<DatabasePrincipal> principals = subject.getPrincipals( DatabasePrincipal.class );
          if ( principals != null && ! principals.isEmpty() ) {
               DatabasePrincipal principal = principals.iterator().next();
               return principal.getConnection();
          }
          return null;
     }
     private Folder getFolderFromAttachment(VWAttachment folderAttachment) {
          ObjectStore objectStore = getObjectStore( folderAttachment.getLibraryName() );
          Folder folder = (Folder) objectStore.getObject("Folder", folderAttachment.getId() );
          return folder;
     }
     private Document getDocumentFromAttachment(VWAttachment documentAttachment) {
          ObjectStore objectStore = getObjectStore( documentAttachment.getLibraryName() );
          Document folder = (Document) objectStore.getObject("Document", documentAttachment.getId() );
          return folder;
     }
     private ObjectStore getObjectStore( String objectStoreName ) {
          Connection connection = getConnection();
          EntireNetwork entireNetwork = Factory.EntireNetwork.fetchInstance(connection, null);
          Domain domain = entireNetwork.get_LocalDomain();
          return Factory.ObjectStore.getInstance( domain, objectStoreName );
     }
     /**
      * Returns the documents filed in the folder.
      *
      * @param folderAttachment the input folder.
      * @return an array of documents filed in the folder.
      * @throws Exception
      */
     public VWAttachment[] getFolderDocuments(VWAttachment folderAttachment ) throws Exception {
          Folder folder = getFolderFromAttachment(folderAttachment);
          DocumentSet containedDocuments = getContainedDocuments(folder);
          Iterator<?> iterator = containedDocuments.iterator();
          ArrayList<VWAttachment> containedDocumentList = new ArrayList<VWAttachment>();
          while ( iterator.hasNext() ) {
               Document document = (Document) iterator.next();
               VWAttachment documentAttachment = getAsVWAttachment(document);
               containedDocumentList.add( documentAttachment );
          }
          return containedDocumentList.toArray( new VWAttachment[0] );
     }
     private DocumentSet getContainedDocuments(Folder folder) {
          PropertyFilter propertyFilter = getContainedDocumentsPropertyFilter();
          folder.fetchProperties( propertyFilter );
          DocumentSet containedDocuments = folder.get_ContainedDocuments();
          return containedDocuments;
     }
     private PropertyFilter getContainedDocumentsPropertyFilter() {
          PropertyFilter propertyFilter = new PropertyFilter();
          propertyFilter.addIncludeProperty( new FilterElement( null, null, null, PropertyNames.CONTAINED_DOCUMENTS, null ) );
          propertyFilter.addIncludeProperty( new FilterElement( 2, null, null, PropertyNames.ID, null ) );
          propertyFilter.addIncludeProperty( new FilterElement( 2, null, null, "DocumentTitle", null ) );
          return propertyFilter;
     }
     private VWAttachment getAsVWAttachment(Document document) throws VWException {
          VWAttachment documentAttachment = new VWAttachment();
          documentAttachment.setLibraryType( VWLibraryType.LIBRARY_TYPE_CONTENT_ENGINE );
          ObjectStore objectStore = document.getObjectStore();
          objectStore.fetchProperties( new String[] { PropertyNames.NAME } );
          documentAttachment.setLibraryName( objectStore.get_Name() );
          document.fetchProperties( new String[] { PropertyNames.ID, PropertyNames.NAME } );
          documentAttachment.setId( document.get_Id().toString() );
          documentAttachment.setAttachmentName( document.get_Name() );
          documentAttachment.setType( VWAttachmentType.ATTACHMENT_TYPE_FOLDER );
          return documentAttachment;
     }
     public void sendJMSMessage(VWAttachment docAttachment, String Message ) throws Exception {
  {
    messageString = Message;
    // A single try block is used here to allow us to focus on the JNDI and I/O
    // operations.
// TODO Production code would need to have much more exception handling.
    try {
      //
      //ASB - Start using Tivoli Directory Services LDAP Context
      //create initial context properties
      String url = "ldap://ecmukdemo6/o=sample";
      String icf = "com.sun.jndi.ldap.LdapCtxFactory";
      java.util.Hashtable environment = new java.util.Hashtable();
      environment.put(Context.PROVIDER_URL, url);
      environment.put(Context.INITIAL_CONTEXT_FACTORY, icf);
      Context ctx = new InitialDirContext(environment);
      Destination        myDest       = null;
      String qManager = "AUDQM";
      // and define the name of the Queue
      String qName = "AUDQAR";
      // Put the message to the queue
      System.out.println("Sending a message...");
      String     cfLookup    = "cn=AUDQCF";
      System.out.println("Lookup connection factory " + cfLookup);
      String     JNDITopic   = "cn=AUDTopic";
      String     JNDIQueue   = "cn=AUDQAR";
      // Class variables
      javax.jms.Session    jmssession     = null; // JMS Session
      javax.jms.Connection jmsconnection  = null; // JMS Connection
      String     dLookup     = "cn=AUDQAR"; // Generic JMS Destination
      String     myMode      = null; // Program mode
      String     destType    = null; // Destination type
      //JMSDEMO
      MQEnvironment.hostname = "ecmukdemo6";
      MQEnvironment.channel  = "SYSTEM.DEF.CLNT.CONN";
      MQEnvironment.port = 1417;
      MQEnvironment.properties.put(CMQC.TRANSPORT_PROPERTY, CMQC.TRANSPORT_MQSERIES_CLIENT);
      MQMessage hello_world = new MQMessage();
      hello_world.writeUTF("Hello World! - First Java Message");
      // Create a connection to the queue manager
      ConnectionFactory connFactory = (ConnectionFactory) ctx.lookup( cfLookup );
      ConnectionFactory factory;
      Queue queue;
      Topic topic;
      queue = (Queue)ctx.lookup(JNDIQueue);
      System.out.println("Create and start the connection");
      jmsconnection = connFactory.createConnection("wasadm","filenet");
      jmsconnection.start();
      System.out.println("Create the session");
      boolean transacted = true;
      javax.jms.Session session= jmsconnection.createSession(transacted, javax.jms.Session.AUTO_ACKNOWLEDGE);
      myDest = (Destination)ctx.lookup(dLookup);
      //Create the session XML Test Message
      String xmlTestMessage = "<?xml version="1.0" encoding="utf-8"?><GRP.SDR.DOC_ACK.REPLY><corrItemID>12345678</corrItemID><CIN>CIN1234567</CIN><msgTimeStamp>2012-12-13T12:12:12</msgTimeStamp><CustMsgDesc>Disposal Date of Document</CustMsgDesc></GRP.SDR.DOC_ACK.REPLY>";
      putMsg( myDest, xmlTestMessage,session );
       // Clean up session and connection
      jmssession.close();
      jmssession = null;
      jmsconnection.close();
      jmsconnection = null;
      jmssession.close();
      jmssession = null;
      JMSconnection.close();
      JMSconnection = null;
    } catch( JMSException je ) {
      System.out.println("caught JMSException: " + je);
      Exception le = je.getLinkedException();
      if (le != null)  System.out.println("linked exception: "+le);
       //TODO Log exception message
    } catch( Exception e ) {
       //TODO Log exception message
         System.out.println("Error : " + e.getMessage());
         System.out.println("Error Stack : " + e.toString());
    // A finally block is a good place to ensure that we don't forget
    // to close the most important JMS objects
    } finally {
      if (JMSsession != null) {
       //Closing Session
       JMSsession.close();
     }
     if (JMSconnection != null) {
       //Closing Connection
       JMSconnection.close();
     }
    }
        //if (le.getMessage() != null)
          //TODO Add to logger
     //Finished
       }
     }
    // A single
  private void putMsg( Destination myDest, String outString, javax.jms.Session jmssession )
    throws JMSException, Exception
  {
//MessageProducer myProducer = JMSsession.createProducer(myDest);//REFLECTION ISSUE!
      if (Message.length() > 0) {
      TextMessage outMessage = JMSsession.createTextMessage();
       //myProducer.send(outMessage); //REFLECTION ISSUE!
        JMSsession.commit();
  }
}
Listing 3-4

The AUDOperations.java code for the Component Integrator

Adding the Supporting Library JAR Files

  1. a)

    First, we add the same IBM FileNet P8 API library .jar files to the Classpath as we added in Chapter 2. Additionally, we need to add the JMS Message library, javax.jms-api-2.0.1.jar, to the Eclipse IDE classpath.

    Create the MQJars folder for the jar files we need:
    (base) [root@ECMUKDEMO6 opt]# mkdir MQJars
    (base) [root@ECMUKDEMO6 opt]# cd MQJars
    (base) [root@ECMUKDEMO6 MQJars]# pwd
    /opt/MQJars
     
  2. b)
    From the MQJars folder, download the com.ibm.mq.allclient.jar file by using curl:
    (base) [root@ECMUKDEMO6 MQJars]#
    curl -o com.ibm.mq.allclient-9.2.4.0.jar https://repo1.maven.org/maven2/com/ibm/mq/com.ibm.mq.allclient/9.2.4.0/com.ibm.mq.allclient-9.2.4.0.jar
     
  3. c)
    From the MQJars folder, download the JMS API file by using curl:
    curl -o javax.jms-api-2.0.1.jar https://repo1.maven.org/maven2/javax/jms/javax.jms-api/2.0.1/javax.jms-api-2.0.1.jar
     
  4. d)
    From the MQJars folder, download the JSON .jar file by using curl:
    curl -o json-20211205.jar https://repo1.maven.org/maven2/org/json/json/20211205/json-20211205.jar
     
  5. e)

    Set the security on the /opt/MQJars and the contained .jar files:

     
chmod 755 -R MQJars/

A screenshot of a window has the dot jar files with its date and time and root codes.

Figure 3-61

The referenced JMS MQ message .jar files are downloaded

  1. f)

    In the Eclipse project Classpath, we now add the preceding downloaded .jar files.

     

A screenshot of the jar selection dialog box has a panel for recent, home, documents, downloads, and music on the left. It has 3 dot jar files selected on the right. The options for cancel, search, and open are given at the top.

Figure 3-62

The copied JMS Java and IBM MQ libraries are placed in the Classpath

A screenshot of the properties for A U D C I O p s window has the java build path details. It has 3 dot jar files selected with options for apply, and apply and close highlighted below.

Figure 3-63

The Apply and Apply and Close update the Classpath

Installing the IBM JRE Java SDK 1.8

We also need to install and load the IBM JRE jre1.8.0.261 Java JRE library on Red Hat Linux 8.0, using the download URL:

www.ibm.com/support/pages/java-sdk-downloads-version-80

A screenshot of the downloads list window has 4 files of different sizes. The first file of installable package under Linux on x 86 systems 64-bit is highlighted.

Figure 3-64

The link to the required IBM JRE 1.8.0.261 library

Note

For Eclipse on Windows systems, the following URL link can be used.

www.ibm.com/support/pages/java-sdk-downloads-eclipse

A screenshot of a window has the dot bin file for I B M J R E highlighted with various root codes.

Figure 3-65

The downloaded IBM JRE is installed on the Linux VMware

The first screen is displayed, as shown in Figure 3-66.

A screenshot of the I B M 64-bit S D K for Linux v 8.0 window has the installation icon with options for language and O K. The language is selected as English.

Figure 3-66

The first install step is used to select the language from the drop-down

The language required is selected from the drop-down, and the OK command button is clicked.

A screenshot of the I B M 64-bit S D K for Linux v 8.0 window has the software license installation detail, with the radio button for I accept the terms in the license agreement highlighted. The options for cancel, previous, and next are given below.

Figure 3-67

The “I accept the terms in the license agreement” is selected

The installation is started with the first screen prompt.

A screenshot of the I B M 64-bit S D K for Linux v 8.0 window has the introduction detail given. The options for cancel, previous, and next are given below.

Figure 3-68

The first installation screen is displayed

The default folder path displayed, /opt/ibm/java-x86_64-80, is used for the installation.

A screenshot of the I B M 64-bit S D K for Linux v 8.0 window has the choose install folder detail, with an input box and options for restore default folder and choose, under where would you like to install. The options for cancel, previous, and next are given below.

Figure 3-69

The installation path is selected as highlighted; click Next>

Click Next on the Installation summary page (or you can cancel at this point).

Then the following installation status should be shown.

A screenshot of the I B M 64-bit S D K for Linux v 8.0 window has the install complete detail with the location highlighted. The options for cancel, previous, and done are given below.

Figure 3-70

The Done command is clicked on the success pop-up window

This JRE installation was then used in the Classpath for the Java Project in place of the Eclipse default.

A screenshot of the add J R E window has the J R E definition detail, with an input box and options for J R E home, J R E name, and default V M arguments. A list of J R E system libraries has a dot jar file selected with 8 options given on the right. The options for back, next, cancel, and finish is given below.

Figure 3-71

The JRE system libraries we installed are confirmed by clicking Finish

The Java Project JRE Libraries are added to the Classpath using the Apply and Close command button.

A screenshot of the preferences filtered window has the installed J R Es option selected on the left panel. It has the list of installed J R Es with the options for add, edit, duplicate, remove, search, and apply on the right. The checkbox for the first J R E is ticked and selected. And the options for cancel, and apply and close are given below.

Figure 3-72

The Apply and Close command is used to add the new JRE library

Next, we need to create a configuration.properties file to hold the required JMS Queue details.

Creating the configuration.properties File

To avoid hard-coding of the many string variables which hold the names of elements, such as the Object Store name and the encrypted IBM FileNet logon credentials, a configuration file is used to hold the string values used by the Java program, as shown in the following section.

A screenshot of the create new file window has the file detail, with the option to enter or select the parent folder and an input box for file name. S R C is selected from the parent folder list. The options for advanced, cancel, and finish are given below.

Figure 3-73

The configuration.properties file is created

The configuration.properties file text is created as follows.
AUDOperationsTest.CEWsiUrl=http://ecmukdemo6:9080/wsi/FNCEWS40MTOM/
AUDOperationsTest.ConnectionPointName=CP1
AUDOperationsTest.EmailFrom=alan.bluck@asbsoftware.co.uk
AUDOperationsTest.EmailTemplatePath=/AUDIT_TEST/AC.pdf
AUDOperationsTest.EmailTo= alan.bluck@asbsoftware.co.uk
AUDOperationsTest.ObjectstoreName=OS2
AUDOperationsTest.Password=filenet
AUDOperationsTest.TestFolderName=/AUDI_TEST
AUDOperationsTest.Username=Alan
AUDOperationsTest.WaspLocation=/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/localhostNode01Cell/FileNetEngine.ear/cews.war/WEB-INF/classes/com/filenet/engine/wsi
AUDOperationsTest.WsiJaasConfigFile=/opt/IBM/ECMClient/configure/CE_API/config/jaas.conf.WSI
Listing 3-5

The configuration.properties JUnit test file

Note

Initially, this configuration.properties file was added to the project src folder, but we reference this from a package folder, so it was moved (dragged and dropped) to the com.ibm.filenet.ps.ciops.test subfolder under the src folder.

Creating the Test Java Package and Code

The com.ibm.filenet.ps.ciops.test Java package subfolder is created as follows.

A screenshot of the new java package window has the java package detail, with the option to select the source folder and an input box for name. A checkbox to create package info dot java is below the name. The options for cancel and finish are given below.

Figure 3-74

The package for testing is created

A screenshot of the new java class window has the java class detail, with the options and input boxes for source folder, package, name, modifiers, superclass, and interfaces. It also has checkboxes to create method stubs and generate comments. The options for cancel and finish are given below.

Figure 3-75

The AUDOperationsTest Java class is created

The code for the AUDOperationsTest Java class is entered as follows.
package com.ibm.filenet.ps.ciops.test;
import static org.junit.Assert.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.jms.Destination;
import javax.naming.Context;
import javax.naming.directory.InitialDirContext;
import javax.security.auth.Subject;
import com.ibm.filenet.ps.ciops.AUDOperations;
import org.junit.BeforeClass;
import org.junit.Test;
import com.filenet.api.constants.PropertyNames;
import com.filenet.api.core.Connection;
import com.filenet.api.core.Document;
import com.filenet.api.core.Domain;
import com.filenet.api.core.EntireNetwork;
import com.filenet.api.core.Factory;
import com.filenet.api.core.Folder;
import com.filenet.api.core.ObjectStore;
import com.filenet.api.util.UserContext;
import filenet.vw.api.VWAttachment;
import filenet.vw.api.VWAttachmentType;
import filenet.vw.api.VWException;
import filenet.vw.api.VWLibraryType;
import filenet.vw.api.VWSession;
/**
* This class contains code for off line testing of the custom component {@link com.ibm.filenet.ps.ciops.AUDOperations AUDOperations}. To
* run this class the different configuration parameters must be set in the configuration.properties file.
*
*/
public class AUDOperationsTest
{
     private static final String EMAIL_TO = Configuration.getParameter("AUDOperationsTest.EmailTo"); //$NON-NLS-1$
     private static final String EMAIL_FROM = Configuration.getParameter("AUDOperationsTest.EmailFrom"); //$NON-NLS-1$
     private static final String EMAIL_TEMPLATES_PATH = Configuration.getParameter("AUDOperationsTest.EmailTemplatePath"); //$NON-NLS-1$
     private static final String OBJECT_STORE_NAME = Configuration.getParameter("AUDOperationsTest.ObjectstoreName"); //$NON-NLS-1$
     private static final String TEST_FOLDER_NAME = Configuration.getParameter("AUDOperationsTest.TestFolderName"); //$NON-NLS-1$
     private static final String USERNAME = Configuration.getParameter("AUDOperationsTest.Username"); //$NON-NLS-1$
     private static final String PASSWORD = Configuration.getParameter("AUDOperationsTest.Password"); //$NON-NLS-1$
     private static final String CONNECTION_POINT_NAME = Configuration.getParameter("AUDOperationsTest.ConnectionPointName"); //$NON-NLS-1$
     private static final String CE_WSI_URL = Configuration.getParameter("AUDOperationsTest.CEWsiUrl"); //$NON-NLS-1$
     private static final String WASP_LOCATION = Configuration.getParameter("AUDOperationsTest.WaspLocation"); //$NON-NLS-1$
     private static final String WSI_JAAS_CONFIG_FILE = Configuration.getParameter("AUDOperationsTest.WsiJaasConfigFile"); //$NON-NLS-1$
     private static Connection connection;
     private static VWSession vwSession;
     /**
      * This method is run before testing is started. It creates connections to the Content Engine and
      * the Process Engine.
      *
      * @throws Exception
      */
     @BeforeClass
     public static void setUpBeforeClass() throws Exception {
          try {
               
               System.setProperty("java.security.auth.login.config", WSI_JAAS_CONFIG_FILE); //$NON-NLS-1$
               System.setProperty("wasp.location",WASP_LOCATION ); //$NON-NLS-1$
               String url = CE_WSI_URL;
               String connectionPointName = CONNECTION_POINT_NAME;
               String password = PASSWORD;
               String username = USERNAME;
               createCEConnection(username, password, url);
               createVWSession(username, password, url, connectionPointName);
          } catch (Exception e) {
               e.printStackTrace();
               throw e;
          }
     }
     private static void createCEConnection(String username, String password, String url) {
          connection = Factory.Connection.getConnection(url);
          Subject subject = UserContext.createSubject(connection, username, password, "FileNetP8"); //$NON-NLS-1$
          UserContext uc = UserContext.get();
          uc.pushSubject(subject);
     }
     private static void createVWSession(String username, String password, String url, String connectionPointName)
               throws VWException {
          vwSession = new VWSession();
          vwSession.setBootstrapCEURI(url);
          vwSession.logon( username, password, connectionPointName );
     }
     private AUDOperations getAUDOperations() {
          return new AUDOperations() {
               @Override
               protected Connection getConnection() {
                    return connection;
               }
     
               @Override
               protected VWSession getVWSession() throws VWException {
                    return vwSession;
               }
          };
     }
     /**
      * Test method for the {@link com.ibm.filenet.ps.ciops.AUDOperations#getFolderDocuments(VWAttachment)} method. It
      * uses a test folder in the object store as input.
      *
      * @throws Exception
      */
     @Test
     public void testGetFolderDocuments() throws Exception {
          VWAttachment folderAttachment = getTestFolder();
          AUDOperations AUDOperations = getAUDOperations();
          VWAttachment[] folderDocuments = AUDOperations.getFolderDocuments(folderAttachment);
          showResults(folderDocuments);
     }
     /**
      * Test method for the {@link com.ibm.filenet.ps.ciops.AUDOperations#sendJMSMessage(VWAttachment docAttachment, String Message ) sendJMSMessage()} method.
      *
      * @throws Exception
      */
     @Test
     public void testJMSMessage() throws Exception {
          ObjectStore objectStore = getTestObjectStore();
          Document document = (Document) objectStore.getObject( "Document", EMAIL_TEMPLATES_PATH ); //$NON-NLS-1$
          VWAttachment documentAttachment = getDocumentAsVWAttachment(document);
          AUDOperations AUDOperations = getAUDOperations();
          //String Message = "Hello JMS MQ World";
         String Message = "<?xml version=1.0 encoding= utf-8/?><AUDIT_REPORT><CaseID>00001</CaseID><COMMENTS>AUD Test on 17th February pm</COMMENTS><AUDIT_DATE>2022-06-27</AUDIT_DATE><AUDIT_STATUS>Date of Audit Report Document</AUDIT_STATUS></AUDIT_REPORT>";
          System.out.println( Message ); //$NON-NLS-1$
           //create initial context properties
           String url = "ldap://ecmukdemo6/o=sample";
           String icf = "com.sun.jndi.ldap.LdapCtxFactory";
           // define the name of the QueueManager
           String qManager = "AUDQM";
           // and define the name of the Queue
           String qName = "AUDQAR";
           // Note that the generic Connection Factory works for both queues & topics
            String     cfLookup    = "cn=AUDQCF";    //ASB
           System.out.println("Lookup connection factory " + cfLookup);
           String     JNDITopic   = "cn=AUDTopic";
           String     JNDIQueue   = "cn=AUDQAR";
           String     dLookup     = "cn=AUDQAR";       // LDAP JMS Destination
           String     hostName = "ecmukdemo6";
           String     channel  = "SYSTEM.DEF.CLNT.CONN";
           String     MQuser = "wasadm";
           String     MQpassword = "filenet"     ;
           String     MQport = "1417";
        AUDOperations.sendJMSMessage(documentAttachment, Message, url, icf, qManager,  qName,
                                           cfLookup,   JNDITopic,   JNDIQueue, dLookup,
                                                           hostName,   channel,     MQport, MQuser, MQpassword);
     }
     private void showResults(VWAttachment[] folderDocuments) {
          System.out.println( folderDocuments.length  +  " documents found" ); //$NON-NLS-1$
          for (VWAttachment attachment : folderDocuments) {
               System.out.println( attachment.toString() );
          }
     }
     private VWAttachment getTestFolder() throws VWException {
          ObjectStore objectStore = getTestObjectStore();
          Folder folder = (Folder) objectStore.getObject( "Folder", TEST_FOLDER_NAME ); //$NON-NLS-1$
          VWAttachment folderAttachment = getFolderAsVWAttachment(folder);
          return folderAttachment;
     }
     private ObjectStore getTestObjectStore()
     {
          EntireNetwork entireNetwork = Factory.EntireNetwork.fetchInstance(connection, null);
          Domain domain = entireNetwork.get_LocalDomain();
          ObjectStore objectStore = Factory.ObjectStore.getInstance( domain, OBJECT_STORE_NAME );
          return objectStore;
     }
     private VWAttachment getDocumentAsVWAttachment(Document document) throws VWException {
          VWAttachment folderAttachment = getCEAttachment(document.getObjectStore() );
          document.fetchProperties( new String[] { PropertyNames.ID, PropertyNames.NAME } );
          folderAttachment.setId( document.get_Id().toString() );
          folderAttachment.setAttachmentName( document.get_Name() );
          folderAttachment.setType( VWAttachmentType.ATTACHMENT_TYPE_FOLDER );
          return folderAttachment;
     }
     private VWAttachment getFolderAsVWAttachment(Folder folder) throws VWException {
          VWAttachment folderAttachment = getCEAttachment(folder.getObjectStore() );
          folder.fetchProperties( new String[] { PropertyNames.ID, PropertyNames.NAME } );
          folderAttachment.setId( folder.get_Id().toString() );
          folderAttachment.setAttachmentName( folder.get_Name() );
          folderAttachment.setType( VWAttachmentType.ATTACHMENT_TYPE_FOLDER );
          return folderAttachment;
     }
     private VWAttachment getCEAttachment(ObjectStore objectStore) throws VWException {
          VWAttachment ceAttachment = new VWAttachment();
          ceAttachment.setLibraryType( VWLibraryType.LIBRARY_TYPE_CONTENT_ENGINE );
          objectStore.fetchProperties( new String[] { PropertyNames.NAME } );
          ceAttachment.setLibraryName( objectStore.get_Name() );
          return ceAttachment;
     }
     /**
      * Utility function for time stamping the different things produced by the test code. This
      * way the result of different tests can be kept apart.
      *
      * @return a timestamp string.
      */
     private static String getTimestamp() {
          SimpleDateFormat timestampFormatter = new SimpleDateFormat("yyyyMMdd HHmmSSS"); //$NON-NLS-1$
          return timestampFormatter.format( new Date() );
     }
}
Listing 3-6

The AUDOperationsTest.java code used for JUnit testing

Note

The comment //$NON-NLS-1$ at the end of some statements is the way to communicate to the compiler that UI messages should not be embedded as string literals, but rather sourced from a resource file (so that they can be translated or easily modified, etc.). Consequently, Eclipse can be configured to detect string literals, so that you don’t accidentally leave unexternalized UI strings in the code. Also, note that some strings, such as regular expressions, are not externalized.

The next step is to create a Configuration Java class.

A screenshot of the new java class window has the Configuration java class detail, with the options and input boxes for source folder, package, name, modifiers, superclass, and interfaces. It also has checkboxes to create method stubs and generate comments. The options for cancel and finish are given below.

Figure 3-76

The Configuration Java class is created

The code for the Configuration Java class is entered as follows.
package com.ibm.filenet.ps.ciops.test;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
public class Configuration {
     //ASB Updated package path for the configuration
     private static final String BUNDLE_NAME = "com.ibm.filenet.ps.ciops.test.configuration"; //$NON-NLS-1$
     private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
     private Configuration() {
     }
     public static String getParameter(String key) {
          try {
               return RESOURCE_BUNDLE.getString(key);
          } catch (MissingResourceException e) {
               return '!' + key + '!';
          }
     }
}
Listing 3-7

The Configuration.java code file used to load the Configuration.properties

A screenshot of the add library dialog box in the properties for A U D C I O p s window has a list of 4 library types to add. The library type titled J unit is selected and highlighted. The options for back, next, cancel, and finish is given below.

Figure 3-77

The JUnit library is added for code testing support

The JUnit library is selected from a drop-down list as shown in Figure 3-78.

A screenshot of the add library dialog box in the properties for A U D C I O p s window has J unit library detail. The option for J unit library version 4 is highlighted. And the options for back, next, cancel, and finish is given below.

Figure 3-78

The JUnit 4 library is selected for the Classpath

The JUnit 4 library version is selected from the drop-down command list.

A screenshot of the properties for A U D C I O p s window has the java build path details. It has the J unit 4 selected with options for apply, and apply and close highlighted below.

Figure 3-79

The JUnit 4 library we selected is confirmed with the Apply and Apply and Close command buttons

Initial Error Fixes

  1. 1)
    First run of the JUnit test class, AUDOperationsTest, we get
    JVMCFRE003 bad major version; class=com/ibm/filenet/ps/ciops/test/AUDOperationsTest, offset=6

    indicating that the compiled class JRE is different from the JVM version, so this was changed in the Eclipse project from 1.7 to 1.8.

     

A screenshot of the properties for A U D C I O p s window has the java compiler details. It has the checkboxes to enable, use, add, and preserve project specific settings, default compliance settings, variable attributes, line number attributes, source file name, and unused local variables ticked. The option for compiler compliance level is highlighted as 1.8.

Figure 3-80

The Java Compiler is changed from Java version 1.7 to 1.8

The next run of the JUnit test class, AUDOperationsTest, gave the output:
com.filenet.api.exception.EngineRuntimeException: FNRCE0051E: E_OBJECT_NOT_FOUND: The requested item was not found. Object identity: /AUDIT_TEST/Audit Event Test Version 2.  Class name: Versionable. errorStack={

The initial document we selected had a Title with spaces in the path, which gave the preceding E_OBJECT_NOT_FOUND FileNet error.

(/AUDIT_TEST/Audit Event Test Version 2 was used initially.)

We found that the code to retrieve a document requires a Document path which does not have the document title with spaces.

The second run, after using the following JUnit Test properties:
AUDOperationsTest.CEWsiUrl=http://ecmukdemo6:9080/wsi/FNCEWS40MTOM/
AUDOperationsTest.ConnectionPointName=CP1
AUDOperationsTest.EmailFrom=alan.bluck@asbsoftware.co.uk
AUDOperationsTest.EmailTemplatePath=/AUDIT_TEST/AC.pdf
AUDOperationsTest.EmailTo= alan.bluck@asbsoftware.co.uk
AUDOperationsTest.ObjectstoreName=OS2
AUDOperationsTest.Password=filenet
AUDOperationsTest.TestFolderName=/AUDIT_TEST
AUDOperationsTest.Username=Alan
AUDOperationsTest.WaspLocation=/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/localhostNode01Cell/FileNetEngine.ear/cews.war/WEB-INF/classes/com/filenet/engine/wsi
AUDOperationsTest.WsiJaasConfigFile=/opt/IBM/ECMClient/configure/CE_API/config/jaas.conf.WSI
Listing 3-8

The updated Configuration.properties file

Now, we get further, but we get the following stack trace:
log4j:WARN No appenders could be found for logger (filenet_error.api.com.filenet.apiimpl.util.ConfigValueLookup).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
[Perf Log] No interval found. Auditor disabled.
<?xml version=1.0 encoding= utf-8/?><AUDIT_REPORT><CaseID>00001</CaseID><COMMENTS>AUD Test on 17th February pm</COMMENTS><AUDIT_DATE>2022-06-27</AUDIT_DATE><AUDIT_STATUS>Date of Audit Report Document</AUDIT_STATUS></AUDIT_REPORT>
Lookup connection factory cn=AUDQCF
Sending a message...
Lookup connection factory cn=AUDQCF
Error : com.ibm.mq.jms.MQQueue incompatible with javax.jms.ConnectionFactory
Error Stack : java.lang.ClassCastException: com.ibm.mq.jms.MQQueue incompatible with javax.jms.ConnectionFactory

So, now we get the error indicating that the class com.ibm.mq.jms.MQQueue cannot be cast to javax.jms.ConnectionFactory.

There is an IBM Technote for this; see the link:

www.ibm.com/support/pages/javalangclasscastexception-error-occurs-during-jndi-lookup-queue-connection-factory

In summary, the ClassCastException occurs when a queue connection factory is defined as a WebSphere MQ Connection Factory instead of a WebSphere MQ Queue Connection Factory.

The application code is similar to the following example:
javax.jms.QueueConnectionFactory myQCF = null;
InitialContext ic = null;
//... setup InitialContext here ...
try
{
myQCF = (QueueConnectionFactory)ic.lookup("jms/myQCF");
}
catch(Throwable e)
{
e.printStackTrace();
}
You can resolve the problem using one of the following methods:
  • Define the queue connection factory as a WebSphere MQ Queue Connection Factory.

  • Use a javax.jms.ConnectionFactory object in the application code rather than a javax.jms.QueueConnectionFactory object.

Configuring the Ports and Library Jar Files for IBM MQ Series

Update JMS tcp 1414 port in the server Firewall for ibm-mqseries using the commands:
firewall-cmd --zone=public --permanent --add-port=1414/tcp
firewall-cmd --reload

The server Firewall is now updated to allow the MQ Series port 1414 to be opened.

Also, add
firewall-cmd --zone=public --permanent --add-port=1417/tcp
firewall-cmd --reload
We also need to be able to reference the following IBM jar file packages: com.ibm.mq.jar
com.ibm.mq.jmqi.jar
com.ibm.msg.client.jms.internal.jar
com.ibm.msg.client.jms.jar
com.ibm.msg.client.provider.jar
We also need the WAS_ROOT/runtimes/com.ibm.ws.ejb.thinclient_8.5.0.jar classpath, where WAS_ROOT is the installation home of the WAS, for example, /opt/WebSphere80/AppServer/runtimes/com.ibm.ws.ejb.thinclient_8.5.0.jar.

A screenshot of a window has several I B M M Q dot jar files highlighted with various root codes.

Figure 3-81

The required IBM MQ reference .jars are found and copied

The copied jars are selected for the Eclipse Java project Classpath.

A screenshot of the jar selection window has a panel for recent, home, documents, downloads, music, pictures, videos, and eclipse on the left. It has 6 dot jar files selected on the right. The options for cancel, search, and open are given at the top.

Figure 3-82

The selected files are referenced

The Java Build Path now has the following selected library .jar files.

A screenshot of the properties for A U D C I O p s window has the java build path details. It has 6 dot jar files selected with options for apply, cancel, and apply and close given below.

Figure 3-83

The required IBM MQ jars are selected from the /opt/MQJars folder

A screenshot of a window has 3 dot jar files for I B M highlighted with various root codes.

Figure 3-84

The com.ibm.ws.ejb.thinclient_8.5.0.jar is copied to /opt/MQJars

A screenshot of the jar selection window has a panel for recent, home, documents, downloads, music, pictures, videos, and eclipse on the left. It has a dot jar file selected on the right. The options for cancel, search, and open are given at the top.

Figure 3-85

The com.ibm.ws.ejb.thinclient_8.5.0.jar is loaded to Eclipse

A screenshot of the properties for A U D C I O p s window has the java build path details. It has a dot jar file selected with options for apply, cancel, and apply and close given below.

Figure 3-86

The com.ibm.ws.ejb.thinclient_8.5.0.jar is added to the Classpath

We also need the following .jar files from <WebSphere Installation Directory>/lib:
j2ee.jar
bootstrap.jar

A screenshot of a window has 2 dot jar files titled j 2 e e and bootstrap with various root codes.

Figure 3-87

The j2ee.jar and bootstrap.jar files are copied

Next, we need the following JARs from <WebSphere Installation Directory>/plugins:
-- com.ibm.ws.runtime.jar
-- com.ibm.ws.emf.jar
-- org.eclipse.emf.ecore.jar
-- org.eclipse.emf.common.jar
-- com.ibm.ffdc.jar

A screenshot of a window has several dot jar files with various root codes and plugins.

Figure 3-88

The listed .jars are also copied

We also required the ibmorb.jar.

A screenshot of a window has a dot jar file titled i b m o r b with a plugin.

Figure 3-89

The ibmorb.jar is copied from the /opt/mqm/java/jre64/jre/lib folder

Added providerutil.jar from the path:

/opt/mqm/java/lib/

A screenshot of a window has a dot jar file titled provider u t i l with various plugins.

Figure 3-90

The providerutil.jar file is added to the /opt/MQJars folder

A screenshot of the jar selection window has a panel for recent, home, documents, downloads, music, pictures, videos, and eclipse on the left. It has 8 dot jar files selected on the right. The options for cancel, search, and open are given at the top.

Figure 3-91

The selected .jars from the /opt/MQJars are added to the Classpath

A screenshot of the properties for A U D C I O p s window has the java build path details. It has 7 dot jar files selected with options for cancel, and apply and close given below.

Figure 3-92

The listed .jars are added using the Apply and Close command

MQ Series Channel Security Settings

The security is set to provide limited access to the stored messages held in the MQ Series message queues.

Read additional information in

“Configuring and running simple JMS P2P and Pub/Sub applications in MQ 7.0, 7.1, 7.5 and 8.0”

www-01.ibm.com/support/docview.wss?uid=swg27023212&aid=1

(IBM Techdoc: 7023212)

See the IBM Technote:

www-01.ibm.com/support/docview.wss?uid=swg21138961

and

www-01.ibm.com/support/docview.wss?uid=swg21577137

The default value for the new feature introduced in 7.1, “Channel Authentication Records” (CHLAUTH), is ENABLED.

Check using the following commands:
su - mqm
runmqsc wasadm

A screenshot of the run m q s c w a s a d m command window has the display queue manager details for q m g r c h l a u t h.

Figure 3-93

The runmqsc wasadm command is run as the mqm user

Then enter the command:
DISPLAY QMGR CHLAUTH
This gives the following (also, see Figure 3-92):
     1 : DISPLAY QMGR CHLAUTH
AMQ8408I: Display Queue Manager details.
   QMNAME(wasadm)                          CHLAUTH(ENABLED)
By default, the following three channel authentication records are generated when a new queue manager is created in 7.1 or later using the command:
DISPLAY CHLAUTH(*)
AMQ8878: Display channel authentication record details.
   CHLAUTH(SYSTEM.ADMIN.SVRCONN)           TYPE(ADDRESSMAP)
   ADDRESS(*)                              USERSRC(CHANNEL)
AMQ8878: Display channel authentication record details.
   CHLAUTH(SYSTEM.*)                       TYPE(ADDRESSMAP)
   ADDRESS(*)                              USERSRC(NOACCESS)
AMQ8878: Display channel authentication record details.
   CHLAUTH(*)                              TYPE(BLOCKUSER)
   USERLIST(*MQADMIN)

A screenshot of the display c h l a u t h command window has the display channel authentication record details with types for system admin, system, and m q admin.

Figure 3-94

The DISPLAY CHLAUTH(*) command is entered

The last record blocks all remote channel access to any MQ Administrator. The effect is that non-administrative users can still connect if suitably authorized to do so, but administrative connections and anonymous connections are disallowed regardless of any Object Authority Manager (OAM) authorization settings. This means that new queue managers in V7.1 are much more secure by default than in previous versions, but with the trade-off that administrative access must be explicitly defined.

1) If this is a production queue manager, then you could stop trying to use a userid that is an MQ Administrator and instead use a non-administrator userid to access the queue manager.

2) If you really want the MQ Administrator to be able to access the queue manager via client channels, you could do one of the following actions:

2a) You can add the following two Channel Authentication Records.

User ID blocking

The first rule blocks administrative users and the MCAUSER "nobody" (which prevents someone from creating a user ID "nobody" and putting it into an authorized group):
$ runmqsc QmgrName
SET CHLAUTH(*) TYPE(BLOCKUSER) USERLIST('nobody','*MQADMIN')
The second rule provides a reduced blacklist for SYSTEM.ADMIN channels that allows administrators to use these. It is assumed here that some other CHLAUTH rule such as an SSLPEERMAP has validated the administrator’s connection or that an exit has done so.
SET CHLAUTH(SYSTEM.ADMIN.*) TYPE(BLOCKUSER) USERLIST('nobody')

The preceding rules apply to SYSTEM.ADMIN.SVRCONN which is used by the MQ Explorer.

If you are using another user-defined channel, such as MY.ADMIN.SVRCONN, then you need to add the following two records:
SET CHLAUTH(MY.ADMIN.SVRCONN) TYPE(ADDRESSMAP) ADDRESS(*) USERSRC(CHANNEL)
SET CHLAUTH(MY.ADMIN.SVRCONN) TYPE(BLOCKUSER) USERLIST('nobody')
Note

It is not advisable to use SYSTEM.DEF.* channels for active connections. The system default channels are the objects from which all user-defined channels inherit properties. The recommended practice is that SYSTEM.DEF.* and SYSTEM.AUTO.* channels should NOT be configured to be usable.

2b) This is a variation of (2a) but allowing the MQ Administrator to only use a particular host.

The first rule blocks MCAUSER “nobody”:
SET CHLAUTH(SYSTEM.ADMIN.SVRCONN) TYPE(BLOCKUSER) USERLIST('nobody')
The second rule removes all access to SYSTEM.ADMIN.SVRCONN:
SET CHLAUTH(SYSTEM.ADMIN.SVRCONN) TYPE(ADDRESSMAP) ADDRESS(*) ACTION(REMOVE)
and the third rule adds an entry for the server that needs access:
SET CHLAUTH(SYSTEM.ADMIN.SVRCONN) TYPE(ADDRESSMAP) ADDRESS(9.27.4x.7y) USERSRC(CHANNEL)
2c) Disable the Channel Authentication Records feature:
ALTER QMGR CHLAUTH(DISABLED)
Warning Disabling this new feature is not recommended for MQ 7.1 production queue managers due to security implications.

Note  Disabling CHLAUTH results in a policy that accepts administrative connections by default. The administrative effort to lock down administrative access with CHLAUTH(DISABLED) is much greater than to do so with CHLAUTH(ENABLED).

We have run the following just for the test version of the sendJMSMessage method used in the Component Integrator queue in this chapter:
ALTER QMGR CHLAUTH(DISABLED)
Executing ALTER QMGR CHLAUTH(DISABLED) displays the following:
AMQ8005: WebSphere MQ queue manager changed.
Note

It is recommended to leave CHLAUTH(ENABLED) and use the other security features of MQ V9.2.x to authenticate administrator connections.

Create a CRL LDAP Authentication

See www.ibm.com/docs/en/ibm-mq/9.2?topic=manager-accessing-crls-arls-using-mq-explorer.

Note

Certificate Revocation Lists (CRLs) also apply to Authority Revocation Lists (ARLs).

For the overview of the use of the CRL lists used for security, see

www.ibm.com/docs/en/ibm-mq/9.2?topic=users-working-revoked-certificates

Use the following procedure to set up an LDAP connection to a CRL:
  1. 1.

    Ensure that you have started your queue manager.

     
  2. 2.

    Right-click the Authentication Information folder and click NewAuthentication Information. In the property sheet that opens:

     

A screenshot of the I B M M Q explorer window has the M Q explorer content detail for authentication information on the right. The M Q explorer navigator panel on the left has the options menu with the options new and C R L L D A P authentication information highlighted for the Authentication Information sub-folder.

Figure 3-95

The MQ Explorer CRL LDAP Authentication Information menu is selected

  1. a.

    On the first page, Create Authentication Information, enter a name for the CRL (LDAP) object.

     

A screenshot of the new C R L L D A P authentication information window has the create a C R L L D A P authentication information detail, with an input box and option for name and select an existing object. The options for back, next, cancel, and finish are given below.

Figure 3-96

The mquser1 User Name is entered for the CRL LDAP Authentication

A screenshot of the I B M M Q explorer dialog box in new C R L L D A P authentication information window gives the object was created successfully message. It has a checkbox for do not show success messages in future. The option for O K is given below.

Figure 3-97

The success pop-up message is displayed to show the LDAP update

  1. b.

    Enter the LDAP server name (ecmukdemo6) as either the network name or the IP address.

     
  2. c.

    If the server requires login details, provide a user ID and, if necessary, a password. (This system used cn=root and filenet.)

     

A screenshot of the I B M M Q explorer window has the M Q explorer content detail for authentication information on the right. The M Q explorer navigator panel on the left has the Authentication Information sub-folder selected.

Figure 3-98

The mquser1 Authentication name is added successfully

  1. 3.

    Right-click the Namelists folder and click NewNamelist. In the property sheet that opens:

     

A cropped screenshot of the I B M M Q explorer window has the M Q explorer content pane for name lists on the right. The M Q explorer navigator panel on the left has the options menu with the options new and name list highlighted for the name lists sub-folder.

Figure 3-99

The New Namelist node menu is selected

  1. a.

    Type a name for the Namelist (AUDNAMES).

     

A screenshot of the new name list dialog box in the I B M M Q explorer window has the create a name list detail for A U D names, with an input box and option for a name and select an existing object. The options for back, next, cancel, and finish is given below.

Figure 3-100

The AUDNAMES list is added and Next clicked

  1. b.

    Add the name of the CRL (LDAP) object (mquser1, from step 2a) to the list.

     

A screenshot of the add to names dialog box in new name list and edit names has the entry m q user 1 in the input box. The options for cancel and O K are given below.

Figure 3-101

The AUDNAMES Namelist has an entry of mquser1 added

  1. c.

    Click OK.

     

A screenshot of the edit names dialog box in new namelist has the entry m q user 1 selected with the options add, edit, and remove below. The options for cancel and O K are given below.

Figure 3-102

The first name, mquser1, is added and the OK button clicked

The OK button is then clicked after adding all the required names to the AUDNAMES list.

A screenshot of the new namelist window has the change properties detail for A U D names, with input boxes and option for namelist name, names, name count, and description. The options for back, next, cancel, and finish is given below.

Figure 3-103

The AUDNAMES description is entered and the Finish button clicked

After entering the AUDNAMES description and clicking the Finish command button, you get a confirmation that the Namelist object was successfully created.

A screenshot of the I B M M Q explorer dialog box in new namelist window gives the object was created successfully message. It has a checkbox for do not show success messages in future. The option for O K is given below.

Figure 3-104

The success message is displayed, indicating the name is added

On clicking the OK button on the pop-up window, the mquser1 name in the AUDNAMES Namelist is displayed.

A screenshot of the I B M M Q explorer window has the M Q explorer content detail for namelists on the right. The M Q explorer navigator panel on the left has the namelists sub-folder selected.

Figure 3-105

The AUDNAMES Namelist shows the mquser1 name

  1. 4.

    Right-click the queue manager, select Properties, and select the SSL page.

     

A cropped screenshot of the I B M M Q explorer window has the M Q explorer content with queue manager w a s a d m detail. The M Q explorer navigator panel on the left has the options menu with the option properties highlighted for the w a s a d m node.

Figure 3-106

The wasadm queue manager properties are selected

The SSL page is selected.

A screenshot of the w a s a d m properties window has the S S L detail, with input boxes and options for S S L key repository, cryptographic hardware, certificate validation policy, certificate label, and others. A checkbox for check certificates is highlighted for the revocation namelist A U D names. The options for cancel and O K are given below.

Figure 3-107

The SSL page is selected, and the check box highlighted is ticked

  1. a.

    Select the Check certificates received by this queue manager against Certification Revocation Lists check box.

     
  2. b.

    Type the name of the namelist (AUDNAMES from step 3a) in the CRL Namelist field.

     

Next, we need to create a New Client connection Channel, AUD.CLNTCONN.

The New Client Connection

A cropped screenshot of the I B M M Q explorer window has the M Q explorer content pane for client connections on the right. The M Q explorer navigator panel on the left has the options menu with the options new and client connection channel highlighted for the client connections sub-folder.

Figure 3-108

The New Client-connection Channel option is selected

The AUD.CLNTCONN Client-connection Channel is created.

A screenshot of the new client connection channel window has the create a client connection channel detail for A U D dot C L N T C O N N, with an input box and option for name and select an existing object. The options for back, next, cancel, and finish is given below.

Figure 3-109

The AUD.CLNTCONN with the SYSTEM.DEF.CLNTCONN is created

Next is then clicked to display the properties to be entered for using the AUD.CLNTCONN with the SYSTEM.DEF.CLNTCONN Channel connection.

A screenshot of a dialog box titled New client connection channel. The queue manager name, Description and connection name are highlighted.

Figure 3-110

The Queue Manager name and the Connection name are entered

Then we scroll down to enter the required value for the Default reconnection and select this as Yes.

A screenshot of a dialog box titled New client connection channel. Under the general tab, the hearbeat interval is set to 300. The default reconnection is set to yes.

Figure 3-111

The Default reconnection option is set to Yes from the drop-down

A screenshot of a dialog box titled I B M, M Q Explorer. Text reads the object was created successfully. The OK button is highlighted.

Figure 3-112

The Client Connection Channel AUD.CLNTCONN is created

The new Client Connection Channel AUD.CLNTCONN is displayed.

A screenshot of a window titled I B M M Q explorer. The client connections tab have the subheadings channel name, channel type, queue manager name, and description.

Figure 3-113

The Client Connection Channel AUD.CLNTCONN

Part 3 – Creating a Non-privileged MQ User for a Client Application Connection

The instructions from this link were followed:

www-01.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.dev.doc/q023960_.htm?lang=en

This procedure creates a non-privileged user ID to be used for a client application which connects to the queue manager. Access is granted for the client application only to be able to use the channel it needs and the queue it needs by use of this user ID.

Procedure

  1. 1.

    Obtain a user ID on the system where the queue manager is running on (the server ecmukdemo6 in this example).

     
  2. 2.

    For this task, this user ID must not be a privileged administrative user. This user ID will be the authority under which the client connection will run on the queue manager.

     
  3. 3.

    Start a listener program with the following commands where

     
  • qmgr-name is the name of your queue manager.

  • nnnn is your chosen port number.

  • For UNIX and Windows systems:

runmqlsr -t tcp -m qmgr-name -p nnnn
If your application uses the SYSTEM.DEF.SVRCONN, then this channel is already defined. If your application uses another channel, create it by issuing the MQSC command:
DEFINE CHANNEL(' channel-name ') CHLTYPE(SVRCONN) TRPTYPE(TCP) +
DESCR('Channel for use by sample programs')
  • channel-name is the name of your channel.

  1. 4.
    Create a channel authentication rule allowing only the IP address of your client system to use the channel by issuing the MQSC command:
    SET CHLAUTH(' channel-name ') TYPE(ADDRESSMAP) ADDRESS(' client-machine-IP-address ') +
    MCAUSER(' non-privileged-user-id ')
    In the command window:
    su - mqm
    runmqsc wasadm
    SET CHLAUTH('SYSTEM.ADMIN.SVRCONN') TYPE(ADDRESSMAP) ADDRESS('10.10.10.90') MCAUSER('db2inst1')
     

A screenshot represents the d b 2 inst 1 user set as a non privileged user id with an I B M M Q channel authentication record set.

Figure 3-114

The db2inst1 user is set as a non-privileged user id

Exit from the runmqsc command.

A screenshot represents the I B M M Q channel authentication record set with the quit command to exit.

Figure 3-115

Exit using the quit command

  • channel-name is the name of your channel.

  • client-machine-IP-address is the IP address of your client system.

If your sample client application is running on the same machine as the queue manager, then use an IP address of “127.0.0.1” if your application is going to connect using “localhost.” If several different client machines are going to connect in, you can use a pattern or a range instead of a single IP address. See www-01.ibm.com/support/knowledgecenter/SSFKSJ_8.0.0/com.ibm.mq.ref.adm.doc/q086080_.htm?lang=en-us (Generic IP addresses) for details.

  • non-privileged-user-id is the user ID you obtained in step 1.

  1. 5.

    If your application uses the SYSTEM.DEFAULT.LOCAL.QUEUE, then this queue is already defined. If your application uses another queue, create it by issuing the MQSC command:

     
DEFINE QLOCAL(' queue-name ') DESCR('Queue for use by sample programs')
  • queue-name is the name of your queue.

  1. 6.

    Grant access to connect to and inquire the queue manager:

     
  • For IBM i, UNIX, and Windows systems, issue the MQSC commands:

SET AUTHREC OBJTYPE(QMGR) PRINCIPAL(' non-privileged-user-id ') +
AUTHADD(CONNECT, INQ)
  • non-privileged-user-id is the user ID you obtained in step 1.

If your application is a point-to-point application, that is, it makes use of queues, grant access to allow inquiring and then putting and getting messages using your queue by the user ID to be used, by issuing the MQSC commands:
  • For IBM i, UNIX, and Windows systems, issue the MQSC commands:

    SET AUTHREC PROFILE(‘ queue-name ‘) OBJTYPE(QUEUE) +

PRINCIPAL(‘ non-privileged-user-id ‘) AUTHADD(PUT, GET, INQ, BROWSE)

  • queue-name is the name of your queue.

  • non-privileged-user-id is the user ID you obtained in step 1.

  1. 7.
    If your application is a publish/subscribe application, that is, it makes use of topics, grant access to allow publishing and subscribing using your topic by the user ID to be used, by issuing the MQSC commands:
    • For IBM i, UNIX, and Windows systems, issue the MQSC commands:

     
SET AUTHREC PROFILE('SYSTEM.BASE.TOPIC') OBJTYPE(TOPIC) +
PRINCIPAL(' non-privileged-user-id ') AUTHADD(PUB, SUB)

A screenshot of a window titled I B M M Q explorer. In the client conditions tab, manage authority records option under object authorities is highlighted.

Figure 3-116

The AUD.CLNTCONN Manage Authority Records option is selected

The Manage Authority Records submenu allows the security on a Client Connections object to be modified to add or remove Users and Groups.

A screenshot of a dialog box titled w a s a d m manage authority records. The sub headings include specific profile folder, navigating authority records, and adding authority records.

Figure 3-117

The AUD.CLNTCONN Manage Authority Records option

The Specific Profiles opener is clicked, and the New command button is selected.

A screenshot of a dialog box titled w a s a d m manage authority records. The specific profile is highlighted. In the groups tab the headings include Name, change, delete and display.

Figure 3-118

The New command button is clicked

A search can now be made to look for a Group or User in the connected LDAP server to add to the security list for the Connection Object.

A screenshot of a dialog box titled New authorites. Entity type is set to User. The other options include entity name, object type, profile name, queue manage name, authorities, and ok button.

Figure 3-119

The db2inst1 user is added to the AUD.CLNTCONN profile

A command-line preview is shown in the New Authorities screen.

After the user is selected, and the required Administration security attributes added, if required from the tick box list shown in Figure 3-119 (Change, Delete, and Display), a pop-up box showing the success of the security changes is shown.

A screenshot of a dialog box titled I B M, M Q Explorer. Text reads the authority was created successfully. The OK button is highlighted.

Figure 3-120

The db2inst1 user is successfully added to the Client-connection channel

Now we can edit the new db2inst1 user’s db2iadm1 group to give the group Change, Delete, and Display security access.

A screenshot of a dialog box titled w a s a d m manage authority records. Under the Groups tab, 4 columns are labelled name, change, delete and display. The edit button is highlighted.

Figure 3-121

The db2iadm1 group is edited to add the security access required for the Group

A screenshot of a dialog box titled edit authorities. The tick boxes of change, delete, and display, under administration, are highlighted.

Figure 3-122

The tick box is selected to give access as required

The user’s Group is also displayed, and the Group security can now be edited to give any Group security access required.

A screenshot of a dialog box titled New authorites. Under the Groups tab, the file names are d b 2 i a m d m 1, m q m, and w a s d m. All files have full security access to client application connection.

Figure 3-123

The db2iadm1 Group now has full security access

In the command window, we can add the user’s security access:
su - mqm
runmqsc wasadm
SET AUTHREC PROFILE('AUDQCF') OBJTYPE(QUEUE) PRINCIPAL('db2inst1') AUTHADD(PUT, GET, INQ, BROWSE)

A screenshot represents the command run to give the user access to the A U D Q C F Queue.

Figure 3-124

The command is run to give the db2inst1 user access to the AUDQCF Queue

The Find Accumulated Authorities menu option is selected.

A screenshot of a window titled I B M M Q explorer. Under client connections, find accumulated authorities under object authorities is highlighted.

Figure 3-125

The Object Authorities ➤ Find Accumulated Authorities is selected

A screenshot of a dialog box titled find the accumulated authorities. It includes entity type, entity name, object type, profile name, queue manager name, and find button.

Figure 3-126

The db2inst1 user has no authority for Queue Manager

To grant Connect authority for a queue manager to a user or group, we can use the following procedure:
  • In the Navigator view, right-click the queue manager, then click Manage Authority Records. The Manage Authority Records dialog opens.

A screenshot of a window with w a s a d m queue manager authority client application, with w a s a d m, object authorities, and manage queue manager authority records highlighted.

Figure 3-127

The wasadm Queue Manager Authority records are edited

  • Highlight the record for the user or group to which you want to add the Connect authority, then click Edit…. The Edit Authorities dialog opens.

  • Select the Connect check box, then click OK.

A screenshot of a dialog box titled w a s a d m manage authority records. It includes groups with sub headings name, alternate user authority, change, connect, delete, display, inquire, and close buttons.

Figure 3-128

The New command is used to add the db2inst1 user

The New command is used to add the missing db2inst1 user to the wasadm queue.

A screenshot of a dialog box represents the w a s a d m queue manager authority records, in which groups with name, alternate user authority, change, connect, delete, display, inquire, and close buttons are exhibited.

Figure 3-129

The security options for the db2inst1 user are added

The OK command button is clicked after setting the required db2inst1 user access options.

A screenshot of a dialog box titled I B M, M Q Explorer. Text reads the authority was created successfully. The OK button is highlighted.

Figure 3-130

The authority for db2inst1 is successfully added

A screenshot of a dialog box titled w a s a d m manage authority records. It exhibits a group tab with name, alternate user authority, change, connect, delete, display, and close button.

Figure 3-131

The authority for the db2inst1 user’s group, db2iadm, can now be seen

The Find Accumulated Authorities menu item can be used to show that the db2inst1 user has access.

A screenshot of a window titled I B M, M Q Explorer. It exhibits client connections tab with channel name, channel type, queue manager name, and description. Find accumulated authorities option is highlighted.

Figure 3-132

The Find Accumulated Authorities menu item is selected

The user list for the Find Accumulated Authorities now shows that db2inst1 user has access.

A screenshot of a dialog box titled find accumulated authorities. The entity type, name, and find button are highlighted.

Figure 3-133

The db2inst1 user has security access on the AUD.CLNTCONN profile

Reconnect to the JMS LDAP server on ecmukdemo6.

A screenshot of a window titled I B M, M Q Explorer. The add initial context, under J M S administered objects is highlighted.

Figure 3-134

The Add Initial Context is selected on the right-mouse click

A screenshot of a dialog box titled Security credentials. It exhibits user D N, password, and OK button.

Figure 3-135

The ecmukdemo6 context is entered with the o=sample LDAP root

A screenshot of a window titled I B M, M Q Explorer. The Destination folder is highlighted on the left. The Destination tab exhibits name, description, class name, messaging provider, and so on.

Figure 3-136

The JMS referenced Queue, AUDQCF, is shown

The TOPIC Profile is set with authorization for db2inst1:
su – mqm
runmqsc wasadm
SET AUTHREC PROFILE('SYSTEM.BASE.TOPIC') OBJTYPE(TOPIC) PRINCIPAL('db2inst1') AUTHADD(PUB, SUB)

A screenshot represents the I B M M Q authority record set to access the Base TOPIC.

Figure 3-137

The IBM MQ Authority record is set for db2inst1 to access the Base TOPIC

The user now has Connect access to the queue manager. When the user accesses the queue manager’s objects, the authorities that you have granted to the user take effect.

Listener Authorities

The next step is to add a LISTENER.TCP profile-based Listener object type with User access for the DB2 db2inst1 user.

A screenshot of a window titled I B M, M Q Explorer. It exhibits the listener object security access is updated for the d b 2 inst 1 user.

Figure 3-138

The Listener object security access is updated for the db2inst1 user

The Listener node is selected, and the LISTENER.TCP security is updated for the db2inst1 Linux DB2 database user, as shown in Figure 3-139.

A screenshot of a dialog box titled L I S T E N E R T, C P. L I S T E N E R T, C P under specific profiles is highlighted.

Figure 3-139

The existing user authorities for the Listener, LISTENER.TCP, profile is displayed

The New command button shown in Figure 3-139 is selected to add the new user, db2inst1.

A screenshot of a dialog box titled New authorities. The entity name d b 2 inst 1 is highlighted. Under administration, the check boxes of change, delete, display and c t r l are highlighted.

Figure 3-140

The Listener Authorities are updated for the db2inst1 user

The OK command button in Figure 3-140 is clicked to add the new user authorities.

A screenshot of a dialog box titled I B M, M Q Explorer. Text reads the authority was created successfully. The OK button is highlighted.

Figure 3-141

The Listener Authorities are confirmed as updated

The OK command now shows the updated Authorities security list.

A screenshot of a dialog box titled L I S T E N E R T C P. d b 2 inst 1 under groups tab is highlighted

Figure 3-142

The updated LISTENER.TCP profile shows the new db2inst1 user’s group

The command lines are run as follows:
su – mqm
runmqsc wasadm
ALTER QMGR CHLAUTH(ENABLED)

A screenshot represents the queue manager channel authentication security system.

Figure 3-143

The Queue Manager Channel Authentication security system is enabled

The wasadm Queue Manager Create Authorities are updated for the db2inst1 user.

A screenshot of a window titled I B M, M Q Explorer. Queue managers, w a s a d m, object authorities and manage create authorities are highlighted.

Figure 3-144

The menu option to Manage Create Authorities is selected

The wasadm Queue Manager node is selected and right-clicked to select the Object Authorities submenu and then the Manage Create Authorities window.

A screenshot of a dialog box titled manage create authorities. The new button is highlighted.

Figure 3-145

The New button is selected to create an entry for the db2inst1 user

The required entries are entered for the db2inst1 user for the security access required.

A screenshot of a dialog box titled new authorities. It exhibits entity type, name, manager name, authorities list, and ok command.

Figure 3-146

The required entries are entered for the db2inst1 user for the security access

A screenshot of a dialog box titled I B M, M Q Explorer. Text reads the authority was created successfully. The OK button is highlighted.

Figure 3-147

The db2inst1 user security access updates are successfully added

On clicking OK for the update authorities, the db2inst1 user’s group is displayed.

A screenshot of a dialog box titled the w a s a d m manage create authorities. It exhibits names, queues, name lists, process definitions, channels, and client connections. d b 2 i a d m 1 is highlighted.

Figure 3-148

The db2iadm1 Group user is displayed

Create test for example MQ Main program REF:

www-01.ibm.com/support/knowledgecenter/SSEQTP_8.5.5//com.ibm.websphere.nd.multiplatform.doc/ae/tmj_pgmng.html#

Stopping and Starting the Queue Manager

A screenshot of a window titled I B M, M Q Explorer. The controlled option under stop is highlighted.

Figure 3-149

The wasadm Queue Manager is stopped

  1. 1.

    End all the activity of queue managers associated with the WebSphere MQ installation.

     

A screenshot of a dialog box titled stop queue manager w a s a d m, the default option is selected to stop control.

Figure 3-150

The wasadm Queue manager default option is selected to stop Controlled

Select the type of Stop required and then click OK.

A screenshot of a window titled I B M, M Q Explorer. It represents the w a s a d m queue manager status with connection status as disconnected, queue manager status and command server status as stopped.

Figure 3-151

The wasadm Queue Manager status is shown

  1. a.

    Run the dspmq command to list the state of all the queue managers on the system.

     
Run either of the following commands from the installation that you are updating:
dspmq -o installation -o status
dspmq -a
dspmq -o installation -o status displays the installation name and status of all operational queue managers associated with all installations of all WebSphere MQ.

A screenshot represents the d s p m q o installation o status command that lists the state.

Figure 3-152

The dspmq -o installation -o status command lists the state

dspmq -a displays the status of active queue managers associated with the installation from which the command is run.
  1. b.

    Run the MQSC command, DISPLAY LSSTATUS(*) STATUS, to list the status of listeners associated with a queue manager:

     
echo "DISPLAY LSSTATUS(*) STATUS" | runmqsc QmgrName

A screenshot presents the status of the w a s a d m queue is confirmed.

Figure 3-153

The status of the wasadm queue is confirmed

  1. c.

    Stop any listeners associated with the queue managers, using the command:

     
endmqlsr -m QMgrName

A screenshot represents the listeners for the w a s a d m queue manager are stopped.

Figure 3-154

Any listeners for the wasadm Queue Manager are stopped

/opt/mqm/bin/mqconfig

A screenshot represents the configuration settings that are checked, and it contains system V semaphores, shared memory, settings, and current user limits.

Figure 3-155

The configuration settings are checked

  1. a)

    Restart the MQ wasadm Queue.

     

A screenshot represents the M Q explorer content. The start option under the w a s a d m is highlighted.

Figure 3-156

The wasadm Queue Manager is restarted

A screenshot of a dialog box titled start queue manager w a s a d m. The OK button is selected.

Figure 3-157

The Start Queue Manager for wasadm is confirmed by clicking OK

The status of the wasadm Queue Manager can be seen as highlighted in Figure 3-158.

A screenshot of a window titled I B M, M Q Explorer. The active status of the restarted w a s a d m queue manager is exhibited.

Figure 3-158

The active status of the restarted wasadm Queue Manager is displayed

Creating a Client Channel for Messaging

A custom Client Channel can be created for messaging based on a standard SYSTEM.DEF.SERVER template Object type, as shown in this section.

The CLIENT.wasadm Server Channel is created as a SYSTEM.DEF.SERVER object type.

A screenshot of a window titled I B M, M Q Explorer. The server channel option under New is highlighted.

Figure 3-159

A new Server Channel is created as highlighted

A screenshot of a dialog box titled new server channel. The new client wasadm server channel is created. The next button is highlighted.

Figure 3-160

A new CLIENT.wasadm Server Channel is created and Next clicked

A screenshot of a dialog box titled select the transmission queue. System clutter transmission queue is selected.

Figure 3-161

The Local Transmission queue type is selected

Add the db2inst1 user to the mqm group:
usermod -a -G mqm db2inst1

Setting Up the Client on Linux

Set up the client component using the MQSERVER environment variable.

We need to find out the network name of the machine which hosts the queue manager (our example QM is called wasadm) from the system administrator.

Log in as the user who will be running the Express File Transfer, who must be a member of the mqm group. (On the ecmukdemo6 Linux server, this is wasadm.)

Open a command prompt.

Type
cd $HOME
Use a text editor to edit the profile. This example assumes that you are using the bash shell, so you need to edit the file $HOME/.bashrc. If you are using a different system shell, consult your system documentation. Add the following text to the bottom of the file:
vi $HOME/.bashrc
    MQSERVER=CLIENT.QM_Name/TCP/'hostname'; export MQSERVER
For example:
    MQSERVER=CLIENT.wasadm/TCP/'ecmukdemo6'; export MQSERVER

A screenshot represents the M Q S E R V E R environment variable that is set up.

Figure 3-162

The MQSERVER environment variable is set up

Replace hostname with the name (ecmukdemo6) that identifies the server machine on the network.

Close the command prompt.

Log out and log back in for the change to take effect.

Check as follows.

A screenshot represents the M Q S E R V E R environment variable is checked, which contains the file, edit, view, search, terminal, and help options on the top.

Figure 3-163

The MQSERVER environment variable is checked

You have now set up the client and server components needed. The next task is to send a message from the client to the server queue manager wasadm.

Sending a Message from a Client to a Server

To send a message from the client to the server queue manager wasadm, which uses the remote queue definition AUDQAR:

Open a command prompt on the client and follow these steps:

Start the amqsputc sample program as follows.

On Linux, change to the MQ_INSTALLATION_PATH/samp/bin directory, where MQ_INSTALLATION_PATH represents the high-level directory in which WebSphere MQ is installed:
[wasadm@ecmukdemo1 Router]$ cd /opt/mqm/samp/bin
Type the command:
./amqsputc AUDCONN1

Testing for Errors

The error "Dead-letter Queue attribute refers to a queue that does not exist (AUDD1) wasadm Queue Manager / General"

Remediation for Missing Dead-Letter Queue, AUDD1

Create Dead-Letter Queue AUDD1.

A screenshot of a window titled I B M M Q explorer. The queues, new, local queue options are highlighted.

Figure 3-164

The Queues ➤ New ➤ Local Queue menu

The menu is selected as shown in Figure 3-164 to create a new AUDD1 Dead-Letter Queue.

A screenshot of a dialog box titled select the like object. The SYSTEM DEAD LETTER QUEUE template object is selected.

Figure 3-165

The SYSTEM.DEAD.LETTER.QUEUE template Object is selected

The Next> command is selected to start the Queue creation process.

A screenshot of a dialog box titled new local queue. The start wizard to create a matching J M S queue tick box selected.

Figure 3-166

The Start wizard to create a matching JMS Queue tick box is selected

Next, we have to select the option to create a matching JMS Queue.

A screenshot of a dialog box titled new local queue. Under general tab, description and default priority are exhibited.

Figure 3-167

The Finish command button is clicked to create the Queue

The pop-up window is loaded to display the creation status for the Queue.

A screenshot of a dialog box titled I B M, M Q Explorer. Text reads the object was created successfully. The OK button is highlighted.

Figure 3-168

The status of the Queue creation is displayed

A screenshot of a dialog box titled new destination. The select button next to J M S context is highlighted.

Figure 3-169

The wizard to create a new JMS queue matching the Dead-Letter Queue is launched

A screenshot of a dialog box titled select the J M S context box. The folder and the OK button is selected.

Figure 3-170

The LDAP server JMS Context is displayed

A screenshot of a dialog box titled new destination. It exhibits the J M S Context, the next button is highlighted.

Figure 3-171

The Next command is clicked to display the Destination JMS object

A screenshot of a dialog box titled select the like object. A U D Q C F and the OK button is highlighted.

Figure 3-172

The AUDQCF queue is displayed

A screenshot of a dialog box titled new destination. It exhibits the name A U D D 1, create with attributes like an existing destination A U D Q C F, and the select option is highlighted.

Figure 3-173

The Next> command is selected to match the AUDD1 Dead-Letter Queue

A screenshot of a dialog box titled new destination. The queue manager queue, and finish button are highlighted.

Figure 3-174

The Finish command is clicked to complete the JMS Queue link

A screenshot of a dialog box titled I B M, M Q Explorer. Text reads the object was created successfully. The OK button is highlighted.

Figure 3-175

The status of the JMS Queue creation command is displayed

On clicking OK on the status display for the queue, the new AUDD1 Dead-Letter Queue is displayed.

A screenshot of a window titled I B M M Q explorer. It represents the new A U D D 1 dead letter queue in the exhibit.

Figure 3-176

The new AUDD1 Dead-Letter Queue is displayed

Test the wasadm Queue Manager again.

A screenshot represents the I B M M Q explorer, w a s a d m, tests, and queue manager w a s a d m, with run default tests highlighted.

Figure 3-177

The changes are tested, using the TestsRun Default Tests menu

The Test error results show we need to create the AUDQ1 Queue.

A screenshot represents the M Q explorer content, description, object name, and category, with one of the file highlighted.

Figure 3-178

The Run Default Tests are conducted on the wasadm Queue Manager

Now, we see the error as follows:
Error     Default Transmission Queue attribute refers to a queue that does not exist (AUDQ1)     wasadm     Queue Manager / General

Remediation for Missing Local Queue, AUDQ1

Create the missing Default Transmission Queue AUDQ1.

A screenshot of a window titled I B M M Q explorer. The new option is selected from the queue option. Local queue under the new option is highlighted.

Figure 3-179

The menu option to create a New Local Queue is selected using the right-mouse button click

The Queue template Object type is selected as SYSTEM.DEFAULT.LOCAL.QUEUE from the Object type list.

A screenshot of a dialog box titled Select the like object. The required object type and the OK button is highlighted.

Figure 3-180

The drop-down list is scrolled down to select the required Object type

The AUDQ1 name is entered for the Local Queue to be created.

A screenshot of a dialog box titled new local queue. It exhibits create a local queue, name, start the wizard to create a matching J M S queue, and next is highlighted.

Figure 3-181

The tick box for JMS Queue creation is selected and Next> clicked

The AUDQ1 Queue creation options are set with the tick box to start the wizard for creating the JMS Queue as highlighted in Figure 3-181, and the Next> command button is then clicked.

A screenshot of a dialog box titled new local queue. It exhibits queue name, type, description, default priority, and finish button.

Figure 3-182

The Finish command button is clicked

The status pop-up window appears after clicking the Finish command button.

A screenshot of a dialog box titled I B M, M Q Explorer. Text reads the object was created successfully. The OK button is highlighted.

Figure 3-183

The OK command button is clicked which launches the New JMS Queue

The New JMS Queue wizard is launched as shown in Figure 3-184.

A screenshot of a dialog box titled new destination. It exhibits new J M S queue, and space for J M S context to select the file.

Figure 3-184

The LDAP server JMS Context created earlier is shown for selection

The JMS Context is supported by the ecmukdemo6 LDAP server o=sample root for searching.

A screenshot of a dialog box titled select J M S queue context. A folder is selected and the OK button is highlighted.

Figure 3-185

The LDAP server, ecmukdemo6, URL is shown to be selected for JMS

A screenshot of a dialog box titled new destination. The J M S context file and the next button are highlighted.

Figure 3-186

The Next command is used to start the creation of the new JMS queue

The AUDQ1 Queue now has to be linked to the JMS Context Queue object in the ecmukdemo6 LDAP server.

A screenshot of a dialog box titled new destination. It exhibits attributes, value, and next command finish button.

Figure 3-187

The details of the New AUDQ1 JMS Context Queue creation are displayed

The AUDQ1 property values for the JMS Context Queue are displayed after clicking Next.

A screenshot of a dialog box titled new destination. It exhibits the General tab with name, description, class name, queue, and finish button.

Figure 3-188

The Finish command is clicked

The New AUDQ1 Queue is now created and shown, displayed in the MQ Explorer.

A screenshot of a window titled I B M M Q explorer. It exhibits the Queue tab with queue name, type, input count and output count.

Figure 3-189

The New AUDQ1 Queue which was created is displayed

Now we need to change the AUDQ1 to Transmission usage.

First, we select the AUDQ1 entry properties menu option using the right-mouse click.

A screenshot represents the M Q explorer content, Properties under A U D Q 1 is highlighted.

Figure 3-190

The current Normal usage option property is changed to Transmission

The Normal queue usage icon shows a letter icon. We need to change this property to show as a Transmission queue.

A screenshot of a dialog box titled A U D Q 1 properties. It exhibits queue name, type, put message, get message, default persistence, scope, and usage is changed from normal to transmission.

Figure 3-191

The Usage is changed from Normal to Transmission

The Transmission option for the queue is reflected in the icon displayed for AUDQ1 after the property change as shown in Figure 3-192.

A screenshot represents the M Q explorer content, queue name A U D Q 1 is selected.

Figure 3-192

The AUDQ1 icon displays the type of Queue as Transmission

Now we can select this as the default Transmission Queue.

A screenshot of a window represents the wasadm queue manager properties selected.

Figure 3-193

The wasadm Queue Manager properties are selected

Now we can select the Communications tab and select the AUDQ1 Queue.

A screenshot of a dialog box titled select the default transmission queue. A U D Q 1 is selected.

Figure 3-194

The wasadm Queue Default transmission queue is set as AUDQ1

Error Log Location

The error logs can be located on the ecmukdemo6 IBM MQ series 9.2.5 server in the following location.

A screenshot represents the error logs found located in the errors subfolder.

Figure 3-195

The error logs are found located in the /var/mqm/errors subfolder

com.ibm.mq.jms.MQQueue incompatible with javax.jms.ConnectionFactory
com.ibm.mq.jms.MQQueue incompatible with javax.jms.ConnectionFactory

This was returned from the existing project.

Add a new JNDI Queue Connection Factory, AUDCF, in MQ Explorer.

A screenshot of a window titled I B M M Q explorer. The connection factory under New is highlighted.

Figure 3-196

A new Connection Factory, AUDCF, is required

The Connection Factory wizard parameter window values are entered.

A screenshot of a dialog box titled New connection factory. A U D C F is entered as the name and highlighted. The next button is also highlighted.

Figure 3-197

A new Connection Factory name, AUDCF, is entered and Next clicked

A screenshot of a dialog box titled New connection factory. The name A U D C F, type connection factory, and next command are highlighted.

Figure 3-198

The Connection Factory download option is clicked

A screenshot of a dialog box titled New connection factory. The name A U D C F, transport M Q client and the next command are highlighted.

Figure 3-199

The Connection Factory option for Transport is selected as MQ Client

A screenshot of a dialog box titled New connection factory. The name A U D C F is selected. The finish button is highlighted.

Figure 3-200

The Next command button is selected to leave the defaults

A screenshot of a dialog box titled New connection factory. It exhibits name, description, class name, provider version, under the general tab and finish button.

Figure 3-201

The Description is added and a Provider Version selected as highlighted

A screenshot of a dialog box titled New connection factory. It exhibits base queue manager, broke queue manager, connection list, local address, connection tag and finish button.

Figure 3-202

The Connection options are entered

A screenshot of a dialog box titled New connection factory. It exhibits channels, client channel definition table U R L, header, message compression, and finish button.

Figure 3-203

The Finish command is used to create the AUDCF Queue

The default Channel is used, and the Finish command is clicked to create the Queue.

A screenshot of a dialog box titled I B M, M Q Explorer. Text reads the object was created successfully. The OK button is highlighted.

Figure 3-204

The success message window is displayed for the AUDCF Queue

A screenshot of a window titled I B M M Q explorer. Create J M S queue under A U D Q A R option in the Queues tab is highlighted.

Figure 3-205

The AUDQAR Queue is selected to create a JMS Queue

A screenshot of a dialog box titled New destination. It exhibits J M S context, and next button.

Figure 3-206

The JMS LDAP Context created earlier is linked to the AUDQAR Queue

A screenshot of a dialog box titled New destination. It exhibits create a destination, name, messaging provider, type, and next button.

Figure 3-207

The JMS Object is set with the name AUDQAR and Next> clicked

A screenshot of a dialog box titled New destination. Create with attributes like an existing destination is selected.

Figure 3-208

The Attributes to be created for the AUDQAR JMS entry are displayed

A screenshot of a dialog box titled New destination. It exhibits a general tab containing name, description, class name, messaging provider, queue, and finish button.

Figure 3-209

The Finish command is clicked to create the AUDQAR JMS Queue

A screenshot of a dialog box titled I B M, M Q Explorer. Text reads the object was created successfully. The OK button is highlighted.

Figure 3-210

The AUDQAR JMS Queue entry is shown as successfully created

A screenshot of a dialog box titled w a s a d m Find authorities. The profile name is set to A U D Q C F and the find button is highlighted.

Figure 3-211

The Find Accumulated Authorities are searched for the AUDQCF factory

A screenshot of a dialog box titled edit authorities. It includes entity type, name, object type, profile name, queue manager name, and authorities with an ok button.

Figure 3-212

The Edit Authorities attributes are all selected using the Select all button

A screenshot of a dialog box titled w a s a d m Find authorities. It represents the w a s a d m user to have the full set of security options.

Figure 3-213

The wasadm user is shown to have the full set of security options

A screenshot represents the J M S Administratives objects. Connection factory under new option is highlighted.

Figure 3-214

The JMS Connection Factories New Connection Factory menu is clicked

A screenshot of a dialog box titled new connection factory, is set as A U D C F 3.

Figure 3-215

The name of the new Connection Factory is set as AUDCF3

A screenshot of a dialog box titled new connection factory. It represents the support X A transactions option.

Figure 3-216

The AUDCF3 Connection Factory is set without the Support XA Transactions option

A screenshot of a dialog box titled new connection factory. Connection factory attributes are exhibited.

Figure 3-217

The AUDCF3 Connection Factory attributes are displayed and Next> clicked

A screenshot of a dialog box titled new connection factory. It represents the A U D C F 3 connection factory defaults used.

Figure 3-218

The AUDCF3 Connection Factory defaults are used

A screenshot of a dialog box titled new connection factory. It represents base queue manager, broke queue manager, connection list, coded character set I D, local address, and connect options.

Figure 3-219

The Connection details are set

A screenshot of create queue manager with enter basic values. Oueue manager name A U D Q M, Default transmission queue A U D Q M T, and dead letter queue A U D Q M T D are highlighted. At the bottom of the page, next button is highlighted.

Figure 3-220

The AUDQM manager and Transmission and Dead-Letter Queue details are entered

A screenshot of queue manager for use circular logging. Log file size, primary files, and secondary files are labeled 4096, 3, 2, respectively. Data and log paths have use default paths checked and next tab is highlighted at the bottom.

Figure 3-221

The logging details are left as the defaults and Next> clicked

A screenshot of create queue manager and the manager name A U D Q M. Check box for create listener configured for T C P forward slash I P is checked. Below it listen on port number 1417 is labeled and finish tab at the bottom right is highlighted.

Figure 3-222

The Listener option is ticked for TCP/IP, and the port number is set to 1417

A screenshot of create queue manager for enter M Q explorer options. Checkboxs for autoreconnect, automatically refresh information shown for this queue manager are checked. At the bottom right finish tab is highlighted.

Figure 3-223

The autoreconnect and refresh options are set with 15-second default

A screenshot of the queue window based on the system default local queue on the right with finish tab highlighted on the bottom right.

Figure 3-224

The attributes of the Queue are based on the default Local Queue

A screenshot of new local queue window to change the properties of the new local queue. General tab is highlighted with a panel on the right and the queue name is A U D Q A R. Finish tab is highlighted on the bottom right of the page.

Figure 3-225

The Finish command is used to create the AUDQAR Local Queue

A screenshot of the new destination to choose the J M S context in which to create the new J M S queue. Tab for next is highlighted at the bottom of the page.

Figure 3-226

The JMS Queue Creation wizard is launched automatically for AUDQAR

A screenshot of new destination to create a destination. Name A U D Q A R, messaging provider I B M M Q and real time, with a text box, Type queue with a text box below. Tab next is highlighted at the bottom of the page.

Figure 3-227

The JMS Queue name, AUDQAR, is left as for the Local Queue name

A screenshot of new destination window to create a destination. Name A U D Q A R with attributes and values are given. Finish button on the bottom right is highlighted.

Figure 3-228

The AUDQAR JMS Queue details are displayed for review

A screenshot of new destination to change the properties for message handling. Expiry, persistence, and priority tabs have application option selected. M Q M D context is default with read and write option enabled and the message body is J M S. Finish button on bottom right is highlighted.

Figure 3-229

The Message handling properties are set as shown and reviewed

A screenshot of new destination window to change properties in general. The panel for general has tabs labeled name, description, class name, messaging provider, queue manager A U D Q M, and queue A U D Q A R. Finish button on the bottom right is highlighted.

Figure 3-230

The Queue Description is entered and Finish clicked to create AUDQAR

A new Client Connection Channel is created as shown in Figure 3-231.

A screenshot of client connections panel on the right represents the S Y S T E M dot D E F dot C L N T dot C O N N client connection channel created.

Figure 3-231

The SYSTEM.DEF.CLNT.CONN Client Connection Channel is created

Part 4 – Second Run of the AUDOperationsTest.java JUnit for JMS Messaging

The second run of the JUnit test is more successful. The console screen output in Figure 3-232 is from the Eclipse IDE JUnit run of the AUDOperationsTest.java Class.

This shows the transmission of a test message to the IBM MQ Connection Factory, AUDCF3, queue and the retrieval of the ten Audit Documents in the output list from the Audit Master Case Manager solution, Target Object Store, /AUDIT_TEST folder.

A screenshot of several commands starting from terminated A U D Operations test J Unit and ends at test audit events through lookup connection, create and start the connection, and create the session.

Figure 3-232

The Eclipse IDE Console Log output of the second JUnit test run

Code Now Updated As Follows for AUDOperations.java

The following Java code is now ready to build into the AUDOperations.jar Content Integrator method file for testing in the IBM Process Designer Workflow environment.
package com.ibm.filenet.ps.ciops;
import java.security.AccessController;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Set;
//JMSDEMO
import javax.jms.*;
import javax.naming.*;
import javax.naming.directory.*;
import java.util.Hashtable;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
import javax.naming.Context;
import javax.naming.directory.InitialDirContext;
import javax.naming.ldap.InitialLdapContext;
import javax.security.auth.Subject;
import com.filenet.api.collection.DocumentSet;
import com.filenet.api.constants.PropertyNames;
import com.filenet.api.core.Connection;
import com.filenet.api.core.Document;
import com.filenet.api.core.Domain;
import com.filenet.api.core.EntireNetwork;
import com.filenet.api.core.Factory;
import com.filenet.api.core.Folder;
import com.filenet.api.core.ObjectStore;
import com.filenet.api.property.FilterElement;
import com.filenet.api.property.PropertyFilter;
import com.ibm.filenet.ps.ciops.database.DatabasePrincipal;
import com.ibm.mq.MQC;
import com.ibm.mq.MQEnvironment;
import com.ibm.mq.MQMessage;
import com.ibm.mq.MQPutMessageOptions;
import com.ibm.mq.MQQueueManager;
import com.ibm.mq.constants.CMQC;
import com.ibm.mq.constants.MQConstants;
import com.ibm.mq.jms.MQConnectionFactory;
import com.ibm.mq.jms.MQQueue;
import com.ibm.msg.client.jms.JmsConnectionFactory;
import filenet.vw.api.VWAttachment;
import filenet.vw.api.VWAttachmentType;
import filenet.vw.api.VWException;
import filenet.vw.api.VWLibraryType;
import filenet.vw.api.VWSession;
import filenet.vw.base.logging.Logger;
//Import JMS related packages
/**
* Alan S.Bluck  26th June 2022
* AUD JMS Message sender Component Integrator code for AUD_Operations
* Adapted from:
* Custom Java component serving as an example for the article
* "Developing Java components for the Component Integrator".
*
*
*/
public class AUDOperations {
javax.jms.Session JMSsession =  null;
javax.jms.Connection JMSconnection = null;
javax.jms.ConnectionFactory  connFactory  = null;
String messageString = null;
String dLookup     = "cn=AUDQCF"; // Generic JMS Destination
private static Logger logger = Logger.getLogger( AUDOperations.class );
//JMS Variables
static              Session    session     = null; // JMS Session
static              Connection connection  = null; // JMS Connection
public AUDOperations() {
//java.sql.Connection databaseConnection = getDatabaseConnection();
//if ( databaseConnection != null ) {
//     logger.debug( databaseConnection.toString() );
//} else {
logger.debug( "No database connection" );
//}
}
protected Connection getConnection() {
String uri = System.getProperty("filenet.pe.bootstrap.ceuri");
return Factory.Connection.getConnection(uri);
}
protected VWSession getVWSession() throws VWException {
String connectionPoint = System.getProperty("filenet.pe.cm.connectionPoint");
return new VWSession(connectionPoint);
}
protected java.sql.Connection getDatabaseConnection() {
Subject subject = Subject.getSubject( AccessController.getContext() );
Set<DatabasePrincipal> principals = subject.getPrincipals( DatabasePrincipal.class );
if ( principals != null && ! principals.isEmpty() ) {
DatabasePrincipal principal = principals.iterator().next();
return principal.getConnection();
}
return null;
}
private Folder getFolderFromAttachment(VWAttachment folderAttachment) {
ObjectStore objectStore = getObjectStore( folderAttachment.getLibraryName() );
Folder folder = (Folder) objectStore.getObject("Folder", folderAttachment.getId() );
return folder;
}
private Document getDocumentFromAttachment(VWAttachment documentAttachment) {
ObjectStore objectStore = getObjectStore( documentAttachment.getLibraryName() );
Document folder = (Document) objectStore.getObject("Document", documentAttachment.getId() );
return folder;
}
private ObjectStore getObjectStore( String objectStoreName ) {
Connection connection = getConnection();
EntireNetwork entireNetwork = Factory.EntireNetwork.fetchInstance(connection, null);
Domain domain = entireNetwork.get_LocalDomain();
return Factory.ObjectStore.getInstance( domain, objectStoreName );
}
/**
* Returns the documents filed in the folder.
*
* @param folderAttachment the input folder.
* @return an array of documents filed in the folder.
* @throws Exception
*/
public VWAttachment[] getFolderDocuments(VWAttachment folderAttachment ) throws Exception {
Folder folder = getFolderFromAttachment(folderAttachment);
DocumentSet containedDocuments = getContainedDocuments(folder);
Iterator<?> iterator = containedDocuments.iterator();
ArrayList<VWAttachment> containedDocumentList = new ArrayList<VWAttachment>();
while ( iterator.hasNext() ) {
Document document = (Document) iterator.next();
VWAttachment documentAttachment = getAsVWAttachment(document);
containedDocumentList.add( documentAttachment );
}
return containedDocumentList.toArray( new VWAttachment[0] );
}
private DocumentSet getContainedDocuments(Folder folder) {
PropertyFilter propertyFilter = getContainedDocumentsPropertyFilter();
folder.fetchProperties( propertyFilter );
DocumentSet containedDocuments = folder.get_ContainedDocuments();
return containedDocuments;
}
private PropertyFilter getContainedDocumentsPropertyFilter() {
PropertyFilter propertyFilter = new PropertyFilter();
propertyFilter.addIncludeProperty( new FilterElement( null, null, null, PropertyNames.CONTAINED_DOCUMENTS, null ) );
propertyFilter.addIncludeProperty( new FilterElement( 2, null, null, PropertyNames.ID, null ) );
propertyFilter.addIncludeProperty( new FilterElement( 2, null, null, "DocumentTitle", null ) );
return propertyFilter;
}
private VWAttachment getAsVWAttachment(Document document) throws VWException {
VWAttachment documentAttachment = new VWAttachment();
documentAttachment.setLibraryType( VWLibraryType.LIBRARY_TYPE_CONTENT_ENGINE );
ObjectStore objectStore = document.getObjectStore();
objectStore.fetchProperties( new String[] { PropertyNames.NAME } );
documentAttachment.setLibraryName( objectStore.get_Name() );
document.fetchProperties( new String[] { PropertyNames.ID, PropertyNames.NAME } );
documentAttachment.setId( document.get_Id().toString() );
documentAttachment.setAttachmentName( document.get_Name() );
documentAttachment.setType( VWAttachmentType.ATTACHMENT_TYPE_FOLDER );
return documentAttachment;
}
/**
* Sends a JMS message using a JMS Queue as the target of the Message.
*
* @param documentAttachment the initiating document from the Workflow
* @param Message
*            xml Message to be sent to the Queue.
* @param url
*            LDAP server URL eg "ldap://ecmukdemo6/o=sample"; where ecmukdemo6 is the server and o=sample is the root organisation for searching.
* @param icf
*            the context factory package used for the JNDI object retrieval usually "com.sun.jndi.ldap.LdapCtxFactory";
* @param qManager
*            the name of the MQ Queue Manager eg wasadm
* @param qName
*            the name of the MQ Queue eg AUDQAR
* @param cfLookup
*            the name of the LDAP lookup Connection Factory to use eg cn=AUDQCF
* @param JNDITopic
*            the name of the LDAP lookup for the MQ Topic eg cn=AUDTopic (Not currently used)
* @param JNDIQueue
*            the name of the LDAP lookup for the MQ Queue eg cn=AUDQCF
* @param dLookup
*            the name of the LDAP lookup for the Message Destination cn=AUDQAR
* @param hostName
*            the MQ Server hostname eg ecmukdemo6
* @param channel
*            the MQ Server listener channel eg SYSTEM.DEF.CLNT.CONN
* @param MQport
*            the MQ Server port eg 1417
* @param MQuser
*            the MQ Server connection user name - this is a Linux/windows O/S user on the MQ Server with access authority to the Queue eg wasadm
* @param MQpassword
*            the MQ Server connection user name password eg filenet
*
* @throws Exception
*/
public void sendJMSMessage(VWAttachment docAttachment, String Message,  String url,       String icf,      String qManager, String qName,
                                             String cfLookup, String JNDITopic, String JNDIQueue, String dLookup,
                                             String hostName, String channel, String sMQport, String MQuser, String MQpassword
) throws Exception {
{
messageString = Message;
// TODO Production code will be required to have much finer grained
// exception handling.
try {
//
//Lookup initial context
//TODO Get MQ Parameters from passed string values
//ASB - Using LDAP Context
//create initial context properties
//String url = "ldap://ecmukdemo6/o=sample";
//String icf = "com.sun.jndi.ldap.LdapCtxFactory";
java.util.Hashtable environment = new java.util.Hashtable();
environment.put(Context.PROVIDER_URL, url);
environment.put(Context.INITIAL_CONTEXT_FACTORY, icf);
Context ctx = new InitialDirContext(environment);
Destination        myDest       = null;
//ASB - Initial Content code End
// define the name of the QueueManager
//String qManager = "wasadm";
// and define the name of the Queue
//String qName = "AUDQAR";
// Put the message to the queue
System.out.println("Sending a message...");
// Note that the generic Connection Factory works for both queues & topics
// String     cfLookup    = "cn=AUDQCF";    //ASB Tests
System.out.println("Lookup connection factory " + cfLookup);
// String     JNDITopic   = "cn=AUDTopic";
// String     JNDIQueue   = "cn=AUDQCF";
// Class variables
javax.jms.Session    jmssession     = null; // JMS Session
javax.jms.Connection jmsconnection  = null; // JMS Connection
//String     dLookup     = "cn=AUDQCF";       // LDAP JMS Destination
String     myMode      = null; // Program mode
String     destType    = null; // Destination type
//JMSDEMO
//MQEnvironment.hostname = "ecmukdemo6";
//MQEnvironment.channel  = "SYSTEM.DEF.CLNT.CONN";
//MQEnvironment.port = 1417;
MQEnvironment.hostname = hostName;
MQEnvironment.channel  = channel;
int MQport = Integer.parseInt(sMQport);
MQEnvironment.port = MQport;
MQEnvironment.properties.put(CMQC.TRANSPORT_PROPERTY, CMQC.TRANSPORT_MQSERIES_CLIENT);
//ASB TODO
//Use two lines of code below for the XML Message
//MQMessage hello_world = new MQMessage();
//hello_world.writeUTF(Message);
// Create a connection to the queue manager
ConnectionFactory connFactory = (ConnectionFactory) ctx.lookup( cfLookup );
ConnectionFactory factory;
Queue queue;
Topic topic;
//Retrieve the Queue object details from the JNDI lookup
queue = (com.ibm.mq.jms.MQQueue)ctx.lookup(JNDIQueue); //ASB Initial code line Changed from (Queue)
System.out.println("Create and start the connection");
jmsconnection = connFactory.createConnection(MQuser,MQpassword);  //ASB Note that this a server Unix user for MQ not the
                                                                  //    LDAP user!
jmsconnection.start();
//
//ConnectionFactory connFactory = (ConnectionFactory) ctx.lookup( cfLookup );
//JmsConnectionFactory connFactory = (JmsConnectionFactory) ctx.lookup( cfLookup );  //ASB FIX
//
System.out.println("Create the session");
//Create the session
boolean transacted = true;
javax.jms.Session session= jmsconnection.createSession(transacted, javax.jms.Session.AUTO_ACKNOWLEDGE);
myDest = (Destination)ctx.lookup(dLookup);
putMsg( myDest, Message,session );
// Clean up session and connection
session.close();
session = null;
jmsconnection.close();
jmsconnection = null;
} catch( JMSException je ) {
System.out.println("caught JMSException: " + je);
Exception le = je.getLinkedException();
if (le != null)  System.out.println("linked exception: "+le);
//TODO Log exception message
} catch( Exception e ) {
//TODO Log exception message
System.out.println("Error : " + e.getMessage());
System.out.println("Error Stack : " + e.toString());
// A finally block is a good place to ensure that we don't forget
// to close the most important JMS objects
} finally {
if (JMSsession != null) {
//Closing Session
JMSsession.close();
}
if (JMSconnection != null) {
//Closing Connection
JMSconnection.close();
}
}
//if (le.getMessage() != null)
//TODO Add to logger
//Finished
}
}
// A single
private void putMsg( Destination myDest, String outString, javax.jms.Session jmssession )
throws JMSException, Exception
{
//MessageProducer myProducer = JMSsession.createProducer(myDest);//REFLECTION ISSUE!
      if (Message.length() > 0) {
      TextMessage outMessage = JMSsession.createTextMessage();
       //myProducer.send(outMessage); //REFLECTION ISSUE!
        JMSsession.commit();
}
myProducer.close();
}
}
Listing 3-9

The AUDOperations.java code is updated for rebuild and deployment

AUDOperations Rebuild and Deploy .jar: Final Prebuild Test

The following Test output was output after adding the log4j.xml and log4j.dtd files from the Audit Event Handlers Java project we covered in Chapter 2.
Configuration property file search order:
    user.dir = /root/eclipse-workspace/AUD_CIOps
    user.home = /root
    java.home = /opt/ibm/java-x86_64-80/jre
Loading configuration resource: FileNetBuild.properties
Configuration for:Config.AutoRefreshEnabled value:null applied
Configuration for:com.filenet.engine.LoggerRefreshInterval value:null applied
[Perf Log] No interval found. Auditor disabled.
Configuration for:FileNet.EJB.ContextProperties value:null applied
Configuration for:com.filenet.AppServerType value:null applied
Configuration for:com.filenet.AppServer value:null applied
JSAS1480I: Security is not enabled because the ConfigURL property file is not set.
Configuration for:com.filenet.api.useLocalAuthentication value:null applied
Configuration for:com.filenet.api.crcl.logging.chatty value:null applied
Configuration for:FileNet.crcl.implementation.api.location value:null applied
Configuration for:FileNet.crcl.implementation.api.locations value:null applied
Configuration for:FileNet.crcl.implementation.api.urls value:null applied
Configuration for:com.filenet.api.util.Id.SequentialDBType value:null applied
Configuration for:CheetahBCMode value:false applied
Configuration for:com.filenet.engine.LogRequestWithError value:null applied
Configuration for:com.filenet.engine.init.DefaultLocale value:en-us applied
Configuration for:com.filenet.locale.equivalents value:|,he_*,iw_*,|,nb_NO,nb_*,no_*,| applied
Configuration for:FileNet.WSI.HttpCookieMaxAge value:null applied
Configuration for:MaximumRetry value:null applied
Configuration for:ExpireSessionInterval value:null applied
Configuration for:BuildVersion value:dap553.1500 applied
Configuration for:FileNet.WSI.HttpChunkSize value:null applied
Configuration for:FileNet.WSI.custom.credential.class value:null applied
Configuration for:FileNet.WSI.custom.credential.usermethod value:getUserName applied
Configuration for:FileNet.WSI.custom.credential.passwordmethod value:getPassword applied
Configuration for:FileNet.WSI.TransportConnectionTimeout value:null applied
Configuration for:FileNet.WSI.stax.XMLOutputFactory value:com.ibm.xml.xlxp.api.stax.XMLOutputFactoryImpl applied
Configuration for:WSITypeAttributeRequired value:null applied
Configuration for:WSIDefaultNamespacePermitted value:null applied
Configuration for:FileNet.WSI.AutoDetectLTPAToken value:null applied
Configuration for:FileNet.WSI.stax.XMLInputFactory value:com.ibm.xml.xlxp.api.stax.XMLInputFactoryImpl applied
<?xml version=1.0 encoding= utf-8/?><AUDIT_REPORT><CaseID>00001</CaseID><COMMENTS>AUD Test on 17th February pm</COMMENTS><AUDIT_DATE>2022-06-27</AUDIT_DATE><AUDIT_STATUS>Date of Audit Report Document</AUDIT_STATUS></AUDIT_REPORT>
Lookup connection factory cn=AUDCF3
Sending a message...
Lookup connection factory cn=AUDCF3
Create and start the connection
Create the session
10 documents found
AC.pdf||2|3|OS2|{00D14A81-0000-C31E-A7D2-F2B7CF2D4803}
AC.pdf||2|3|OS2|{00D14A81-0000-C31E-A7D2-F2B7CF2D4803}
AC.pdf||2|3|OS2|{00D14A81-0000-C31E-A7D2-F2B7CF2D4803}
AC.pdf||2|3|OS2|{00D14A81-0000-C31E-A7D2-F2B7CF2D4803}
AC.pdf||2|3|OS2|{00D14A81-0000-C31E-A7D2-F2B7CF2D4803}
AC.pdf||2|3|OS2|{00D14A81-0000-C31E-A7D2-F2B7CF2D4803}
AC.pdf||2|3|OS2|{00D14A81-0000-C31E-A7D2-F2B7CF2D4803}
Audit Event Test Version 2||2|3|OS2|{A0DA5481-0000-C216-A96D-41296308BB2E}
Automatic Folder ID added||2|3|OS2|{30085581-0000-C416-9A60-74FB38E99E4D}
Test Audit Events||2|3|OS2|{40D35481-0000-CA14-BF15-512387B70CF4}
Listing 3-10

The JUnit test output after adding the log4j.xml and log4j.dtd files

A screenshot of commands for starting M Q S C for queue manager A U D Q M. The highlighted commands are run m q s c A U D Q M, D I S LISTENER LISTENER . T C P, and DISPLAY Q M G R C H L A U T H.

Figure 3-233

The runmqsc command displays the details of AUDQM Queue Manager

A screenshot of A U D Operations test on the left and list of options on the right panel where run as is selected that further highlights the option of J u 1 unit test.

Figure 3-234

The AUDOperationsTest run for JUnit testing is run

A screenshot of message browser window with queue manager name A U D Q M, and queue name A U D Q A R. A table with 5 columns and 7 rows where row 7 is selected with further option properties selected. Close button on the bottom right is selected.

Figure 3-235

The results of the Test Run are displayed in the Properties of the Queue Entry (dated July 4, 2022)

A screenshot of message 7 properties window with selected option data on the left panel. The right panel has properties of data length, format, encoding, data bytes. Close button is highlighted at the bottom right of the page."

Figure 3-236

The Data property of the Queue Entry shows the message from the Java

Part 5 – Building the AUDOperations.jar

Next, we need to export the Java program in the AUDOperations.jar file with the exposed methods we wish to call from our IBM Process Designer Workflow.

A screenshot of the A U D operations . Java selected on the left panel and export option selected on the right panel.

Figure 3-237

The AUDOperations.java is compiled and exported as a jar file

A screenshot of export window with select an export wizard list where J A R file is selected. Next button on the bottom of the page is selected.

Figure 3-238

The Eclipse IDE Java ➤ JAR file export wizard is selected

A screenshot of JAR export window with A U D underscore C I ops selected on the left panel and . project selected on the right. Export generated class files and resources and compress the contents of the JAR file options are ticked. At the bottom of the page next button is highlighted and finish button is selected.

Figure 3-239

The options for exporting the Java JAR file are selected

A screenshot of save as window with s r c option selected and file name A U D Operations . jar d e s c highlighted. Bottom of the page has option O K selected.

Figure 3-240

The AUDOperations.jardesc file is saved to the Project Source folder

A screenshot of JAR export window with checked options for export class files with compile errors and warnings and save the description of this JAR in the workspace with highlighted browse button for the description file. At the bottom next tab is highlighted while the finish tab is selected.

Figure 3-241

The Browse command is used to select the path for the .jardesc file

A screenshot of JAR export window with the MANIFEST dot M F generation option selected and defined for save. At the bottom Finish button is highlighted and selected.

Figure 3-242

The MANIFEST.MF generation option is selected and defined for save

A screenshot of JAR export window with text JAR export finished with warnings. See details for additional information. Details button is highlighted while O K button is highlighted and selected.

Figure 3-243

The AUDOperations jar file is exported with compile warnings

The status of the AUDOperations.jar build is shown in Listing 3-11.
An Eclipse AUDOperations.jardesc file was created.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jardesc>
    <jar path="/root/eclipse/java-2021-12/eclipse/AUDOperations.jar"/>
    <options buildIfNeeded="true" compress="true" descriptionLocation="/AUD_CIOps/src/AUDOperations.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
    <storedRefactorings deprecationInfo="true" structuralOnly="false"/>
    <selectedProjects/>
    <manifest generateManifest="true" manifestLocation="/AUD_CIOps/bin/MANIFEST.MF" manifestVersion="1.0" reuseManifest="false" saveManifest="true" usesManifest="true">
        <sealing sealJar="false">
            <packagesToSeal/>
            <packagesToUnSeal/>
        </sealing>
    </manifest>
    <selectedElements exportClassFiles="true" exportJavaFiles="false" exportOutputFolder="false">
        <file path="/AUD_CIOps/.classpath"/>
        <file path="/AUD_CIOps/.project"/>
        <javaElement handleIdentifier="=AUD_CIOps/src&lt;com.ibm.filenet.ps.ciops"/>
    </selectedElements>
</jardesc>
Listing 3-11

The AUDOperations.jardesc file list

Rebuilding the AUDOperations.jar File

To rebuild the AUDOperations.jar file, we can make use of the AUDOperations.jardesc file we created.

Note

Make a backup (if required) of the previous AUDOperations.jar first!

Right-click this AUDOperations.jardesc file in the Project area AUD_CIOPS and select Create Jar from the menu, then click Yes when prompted to overwrite the existing AUDOperations.jar file. (Click OK.)

Copy the compressed AUDOperations.jar file to the Installs folder for import as a System Component Integrator step.

The configuration.properties file contains the following (used for the JUnit test harness).
AUDOperationsTest.CEWsiUrl=http://ecmukdemo6:9080/wsi/FNCEWS40MTOM/
AUDOperationsTest.ConnectionPointName=CP1
AUDOperationsTest.EmailFrom=alan.bluck@asbsoftware.co.uk
AUDOperationsTest.EmailTemplatePath=/AUDIT_TEST/AC.pdf
AUDOperationsTest.EmailTo= alan.bluck@asbsoftware.co.uk
AUDOperationsTest.ObjectstoreName=OS2
AUDOperationsTest.Password=filenet
AUDOperationsTest.TestFolderName=/AUDIT_TEST
AUDOperationsTest.Username=Alan
AUDOperationsTest.WaspLocation=/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/localhostNode01Cell/FileNetEngine.ear/cews.war/WEB-INF/classes/com/filenet/engine/wsi
AUDOperationsTest.WsiJaasConfigFile=/opt/IBM/ECMClient/configure/CE_API/config/jaas.conf.WSI
Listing 3-12

The latest configuration.properties JUnit test file parameters

FileNet Workflow System Component AUDOperations.jar Deployment

Create a new Component Queue, AUD_Operations, in the Workflow System:
  1. a)

    Log in to the FileNet Administration Console for Content Engine (acce) web application configuration tool.

     

A screenshot of I B M administrative console for content platform engine log in page. The highlighted tabs are user name Alan and encrypted password. Log in tab is also highlighted with logo of I B M at its right.

Figure 3-244

The acce administration web application is logged in to

  1. b)

    First, import the AUDOperations.jar file as a new Code Module.

     

A screenshot represents the selected actions, and a new document in the menu is selected on the code module tab.

Figure 3-245

Select the ActionsNew Document menu item on the CodeModules tab

A screenshot of the code module document class selected from the drop down and highlighted.

Figure 3-246

The Code Module Document Class is selected from the drop-down

A screenshot of the document title entered as A U D operations dot jar and class entered as code module and the next button is highlighted.

Figure 3-247

The Document title is entered as AUDOperations.jar and Next> clicked

The Document title is entered as AUDOperations.jar and Next> is clicked with the tick box selected to allow the AUDOperations.jar file to be included as the Code Module Document Object content.

A screenshot of chrome browser with several tabs open for I B M. The I B M administrative console for content platform engine is open with O S 2 panel on the left and new document on the irght with add button highlighted.

Figure 3-248

The Add button is clicked to add the AUDOperations.jar as content

The Add button loads a Web Browser window which can be used from the acce web application to locate and select the built AUDOperations.jar file.

A screenshot of chrome browser with installs text highlighted at the top and A U D Operations dot jar selected from the installs subfolder.

Figure 3-249

The AUDOperations.jar is selected from the Installs subfolder

The Add Content Element pop-up window is shown allowing the browsed AUDOperations.jar file to be confirmed and its content added using the Add Content command button.

A screenshot of add content element box with add content button highlighted.

Figure 3-250

The Add Content button is clicked to complete the Content addition

A screenshot of new document tab with next button highlighted and circle to check the box is highlighted under content elements section.

Figure 3-251

The Next> button is clicked after upload of the AUDOperations.jar

The Next> command button shows the following Object Property Name values which we leave blank and then click Next> again.

A screenshot of new document tab with next button highlighted. The table for object properties have 8 columns and several rows for the properties.

Figure 3-252

The Next> command button is clicked leaving all the default values

A screenshot of new document tab with next button highlighted. Under it document content and version have 3 options with square box for each.

Figure 3-253

The Next> command button is clicked leaving all the default values

A screenshot of new document tab with next button highlighted. Under it specify settings for retaining objects have default retention period and none options selected for retention date.

Figure 3-254

The Next> command button is clicked leaving a Default retention period

A screenshot of new document tab for advanced features with next button highlighted. default database storage area is selected and highlighted from drop down for storage area.

Figure 3-255

The Default Database Storage Area is selected from the drop-down

After clicking Next> for the Code Module Document Advanced Features, the Code Module Document build parameters are displayed and created using the Finish command button.

A screenshot of new document tab for summary with finish button highlighted. Summary table has 2 columns of name and value, and several rows with parameters.

Figure 3-256

The summary of the parameters for creating the Code Module is shown

A screenshot of new document tab for A U D Operations dot jar code module created successfully with the close button highlighted.

Figure 3-257

The AUDOperations.jar Code Module is created successfully

  1. c)

    Select the required Object Store Workflow System node as shown in Figure 3-258.

     

A screenshot of the workflow system node selected on the left panel and general tab of the workflow system open in the right panel.

Figure 3-258

The Workflow System node is selected

  1. a)

    In the object store navigation pane, click the AdministrativeWorkflow SystemIsolated Regions folder and click the isolated region that you want to modify.

     

A screenshot represents the new component queue menu item selected in the component queue pane under workflow system pane.

Figure 3-259

The New Component Queue menu item is selected

  1. b)

    Right-click the Component Queues folder and click New Component Queue.

     

A screenshot presents the component queue named A U D underscore operations to the workflow system queue folder.

Figure 3-260

The Component Queue is named AUD_Operations

  1. c)

    The AUDOperations.jar Code Module we created earlier is loaded.

     

A screenshot of I B M administrative console for content platform Engine page with the load existing command button selected and highlighted.

Figure 3-261

The Load Existing command button is selected

  1. d)

    Then, the AUDOperations.jar file Code Module we added earlier is selected.

     

A screenshot of select a code module box with code module name A U D operations . jar is highlighted and selected from the drop down.

Figure 3-262

The AUDOperations.jar Code Module is selected

  1. e)

    Select the previously loaded AUD_Operations code module.

     

A screenshot represents the list of the available methods advertised as expected.

Figure 3-263

The Available methods list is shown as expected

On loading the AUDOperations.jar file, the system uses Java reflection to identify and display the public methods which can be called in a Component Integrator step in the IBM Case Manager workflow steps, which we will cover later in this chapter.

A screenshot of the adapter properties, which are advertised with the defaults used.

Figure 3-264

The Adapter Properties are shown and the defaults used

A screenshot of the new component tab advertised with the J A A S authentication prompts.

Figure 3-265

The New Component tab is displayed with JAAS authentication prompts

It should be noted that the Configuration context was changed later to CELogin in Figure 3-265.

A screenshot of the finish command used to create the A U D underscore operations queue to the system configuration context with finish button highlighted.

Figure 3-266

The Finish command is used to create the AUD_Operations Queue

A screenshot of the A U D underscore operations queue that is advertised to be created successfully.

Figure 3-267

The AUD_Operations Queue is shown to be created successfully

A screenshot of the O S 2 panel on the left and component panel on the right with A U D underscore operations highlighted.

Figure 3-268

The AUD_Operations Component Queue is now available for use

The preceding steps were repeated for the OS1 Design Object Store.

In summary as follows:

A screenshot of A U D Operations dot jar created in the O S 1 design object store with the code module and finish button highlighted.

Figure 3-269

The AUDOperations.jar is created in the OS1, Design Object Store

A screenshot of I B M administrative console for content platform engine with O S 1 panel on the left and successful creation of A U D Operations dot jar in the right panel.

Figure 3-270

The created AUDOperations.jar in the OS1 Design Object store

A screenshot represents the parameters for the A U D underscore operation component, where the finish button is highlighted.

Figure 3-271

The parameters for the AUD_Operations Component Queue

A screenshot of the O S 1 panel on the left and successful creation of the A U D operations component on the right panel.

Figure 3-272

The AUD_Operations Component Queue is created

A screenshot of import operations box with options JAR file, Java class, and available methods with options selected.

Figure 3-273

The methods need to be exposed for use in the Workflow

The Component Queues Import Operations system uses Java reflection to identify the available public methods to be called, from which the option is available to tick a selection box as shown in Figure 3-273. We selected the two methods, getFolderDocuments and sendJMSMessages, which were tested in the Eclipse JUnit test harness, AUDOperationsTest.java.

A screenshot of operation box with general tab selected. Name section has text send J M S message and description reads This method sends a message to the A U D Q A R M Q system which is highlighted. Bottom right has O K button highlighted.

Figure 3-274

The General tab is used to add the Description for the method

The sendJMSMessage method sends a message to the AUDQAR MQ System.

First, a description is entered for the General tab.

A screenshot of operation box with general tab selected. Name section has text get folder documents and description reads This method retrieves all the documents attached to a given folder path which is highlighted.

Figure 3-275

The description for the getFolderDocuments method is entered

Editing the Parameters

Next, the 15 parameters are edited with their names on the Parameters tab.

Because of the way in which these parameters are sorted, you might find it easier to keep track of the order by deleting all the template parameters and then adding them back one at a time since it is easy for the parameter order to be set mismatching the Java method argument call order.

The parameters for the sendJMSMessage method are viewed as templates on the Parameters tab. Notice that the param names are not displayed in strict numeric order, and the first attempt to edit with the parameter names led to some being out of order, when displayed as a workflow component step set of arguments. For accuracy of entry, all the automatically created parameters were first deleted and then added back and set up with their names in the correct order for the calling sendJMSMessage method.

A screenshot of operation box with parameters tab selected with 2 tabs for new and delete under it a table with 4 columns and several rows is given.

Figure 3-276

The 15 parameters of the sendJMSMessage method

A screenshot of the first attempt at entering the parameters by overwriting the templates of the A U D Operations.jar file process.

Figure 3-277

The first attempt at entering the parameters by overwriting the templates

Checking the Deployment in Component Manager and Workflow

We can now launch the Standalone Process Designer Java program using the Windows cmd.exe DOS window (which we launch as the Windows administrator), with the commands as follows:
cd c:PROGRA~2IBMFileNetContentEngine oolsPE
pedesigner.bat CP1

This loads a pop-up window prompting us for a Process Engine administrator login (see Chapter 2, Figure 2-190).

IBM Process Designer Component Queue Configuration

After the parameters for the AUD_Operations have been configured using the IBM FileNet Content Engine acce web administration tool, the Workflow Component Queues have to be configured using the IBM Process Designer Java application. The menu item ViewConfiguration allows the Component Queues to be configured, as shown in Figure 3-278.

A screenshot of the configuration menu that launches the configuration tool, where the ok button is highlighted.

Figure 3-278

The ViewConfiguration menu launches the Configuration tool

A screenshot of the highlighted icon in the action bar line that commits changes back to the object store component queue workflow system.

Figure 3-279

The highlighted icon on the Action bar line commits changes back to the Object Store Component Queue Workflow system

A screenshot of the list of queue properties to be updated is displayed with the closed button.

Figure 3-280

The list of Queue Properties to be updated is displayed

A screenshot of the A U D underscore operations queue created by right click the component queues node in the process designer configuration tool is advertised.

Figure 3-281

The AUD_Operations queue is created by right-clicking the Component Queues node in the Process Designer Configuration tool view

A screenshot of the security J A A S credentials entered for the A U D Operations dot jar file process.

Figure 3-282

The Security JAAS Credentials are entered

Note
The Configuration Context was updated from the displayed FileNetP8 value to CELogin in Figure 3-282.

A screenshot of the code module selected highlighted icon in A U D operations dot jar file process.

Figure 3-283

The Code Module is selected using the highlighted icon

A screenshot of the A U D Operations dot jar file selected from the O S 1 design object.

Figure 3-284

The AUDOperations.jar file is selected from the OS1 Design Object store

A screenshot of the send J M S Message parameters are advertised in the A U D Operations dot jar file process.

Figure 3-285

The sendJMSMessage parameters are displayed

A screenshot of the component step that is dragged and dropped to the new workflow to the A U D Operations dot jar file process.

Figure 3-286

The Component step is dragged and dropped to the new Workflow

A screenshot of the highlighted icon selected to allow the selection of the required queue.

Figure 3-287

The highlighted icon is selected to allow selection of the required queue

A screenshot of the send J M S message method clicked to load the call parameters to A U D underscore operations.

Figure 3-288

The sendJMSMessage method is clicked to load the call parameters

A screenshot of the expression values that can be filled with string values to A U D O operations dot jar.

Figure 3-289

The Expression values can be filled with String values

A screenshot of the right mouse click on the component node that is used to add additional java classes.

Figure 3-290

The right-mouse click on the Component node is used to add additional Java classes

Additional supporting MQ libraries are required in the AUD_Operations Classpath to allow the installed methods to run correctly. These are added as follows.

A screenshot of commands for the required M Q series J M S message libraries is copied for installation.

Figure 3-291

The required MQ Series JMS message libraries are copied for installation

A screenshot of the required dot jar libraries imported from the install directory.

Figure 3-292

The required .jar libraries are imported from the Installs directory

A screenshot of the workflow saved as A U D underscore J M S message dot pep is selected and saved as A U D underscore J M S message. pep.

Figure 3-293

The workflow is saved as AUD_JMSMessage.pep

A screenshot of the changes to the A U D operations queue are committed and the continue button is highlighted.

Figure 3-294

The changes to the AUD_Operations queue are committed

A screenshot of the A U D operations.jar file, where the order of the initial parameters is advertised to be incorrect.

Figure 3-295

The initial parameter order is shown to be incorrect!

As shown in Figure 3-295, the initial sendJMSMessage method argument list order was incorrect, because the template parameters are not correctly ordered in the list box! The parameters were then reentered singly.

A screenshot of the A U D operations parameters that are reentered one at a time and with three buttons ok, cancel, and help.

Figure 3-296

The AUD_Operations parameters are reentered one at a time

A screenshot of the launch step, component, where the component step parameters are now ordered correctly.

Figure 3-297

The Component step parameters are now ordered correctly

A screenshot of the workflow is validated and restored and a close button is highlighted.

Figure 3-298

The workflow is validated and resaved

Note

It was discovered that the following original section of code (lines in red bold) caused Java reflection to fail in the import tool, so parameters were not exposed!

      MessageProducer myProducer = JMSsession.createProducer(myDest);
      if (Message.length() > 0) {
        TextMessage outMessage = JMSsession.createTextMessage();
        outMessage.setText(Message);
        myProducer.send(outMessage);
         JMSsession.commit();
      }
The new code is as follows (using a different Queue Factory class):
private void putMsg( Destination myDest, String outString, javax.jms.Session jmssession )
throws JMSException, Exception
{
// Use generic MessageProducer instead of Queue/Topic Producer
MessageProducer myProducer = jmssession.createProducer(myDest);
// Get user input and create messages.  Loop until user sends CR.
if (outString.length() > 0) {
TextMessage outMessage = jmssession.createTextMessage();
outMessage.setText(outString);
myProducer.send(outMessage);
jmssession.commit();
}
myProducer.close();
}

Part 6 – Transferring Workflow and Setting Up Workflow Subscriptions

Creating a Workflow Subscription on a New Audit Report Document Event

The Target Object store, OS2, with a Workflow Definition document class (AUD_JMSMessage.pep file) is used to run the Workflow we created, after a new Audit Report document is created in the Target Object store from an Audit Master solution Case Manager Audit Department Case.

Logging in to the acce web Administration console, we can create the required Workflow Subscription as follows.

A screenshot of the audit report class used for the basis of the new workflow subscription.

Figure 3-299

The Audit Report class is used for the basis of a new Workflow subscription

A screenshot of the A U D underscore send J M S audit subscription created to launch the workflow.

Figure 3-300

The AUD_SendJMSAudit subscription is created to launch the Workflow

A screenshot to create a workflow subscription must be ticked and with next button is highlighted.

Figure 3-301

The Create a workflow subscription must be ticked

A screenshot of the creation event selected to trigger the workflow and the creation event is highlighted.

Figure 3-302

The Creation Event is selected to trigger the Workflow

Transferring the JMS Test Workflow to the Target Object Store

The Workflow created in the standalone Process Designer Java applet must be transferred to the Target Object Store to allow it to be triggered by the Workflow Subscription Event we created in the previous section.

A screenshot of the J M S test workflow is transferred to the target object store and with ok, cancel, help buttons,

Figure 3-303

The JMS test workflow is transferred to the Target Object store

A screenshot of the launch step, a component with the transfer was successful and the close button is highlighted.

Figure 3-304

The status of the Workflow Transfer is displayed by the Process Designer

A screenshot of the O S 2 published folder used to save the workflow definition ad the next button is highlighted.

Figure 3-305

The OS2:Published folder is used to save the Workflow Definition

A screenshot of workflow definition 1 window with a pane of save the workflow definition to an object store in it. Document title in it is labeled A U D underscore J M S message workflow and highlighted. At the bottom next button is highlighted. "

Figure 3-306

The Workflow Definition is saved as AUD_JMSMessageWorkflow

A screenshot of the window for save the workflow definition to an object store. The screen has a table drawn and at the bottom finish button is highlighted.

Figure 3-307

The Security for the Workflow Definition is displayed. Click Finish to create it

A screenshot of process designer window with a box for check workflow name. In the box use this workflow name and O K are highlighted at the top and bottom, respectively.

Figure 3-308

The AUD_JMSMessageWorkflow is transferred to the Target Object Store

A screenshot of the new subscription tab with highlighted button for next. A U D underscore J M S message workflow is highlighted for the workflow definition.

Figure 3-309

The Workflow Event Action can now be selected with the transferred definition

A screenshot of the A U D underscore send J M S M message to underscore launch workflow subscription name is entered.

Figure 3-310

The AUD_sendJMSMessage_LaunchWorkflow subscription name is entered

A screenshot of the new subscription tab where create a workflow subscription option is selected.

Figure 3-311

The Create a workflow subscription option is selected

A screenshot of the new subscription tab where the creation event is selected.

Figure 3-312

The Creation Event is selected

A screenshot of the A U D underscore J S M message workflow selected from the drop down button is highlighted.

Figure 3-313

The AUD_JMSMessageWorkflow is selected from the drop-down and Next> clicked

A screenshot of the workflow fields mapped to the audit report document class properties.

Figure 3-314

The Workflow Fields are mapped to the Audit Report Document class properties

A screenshot of the enable subscription flag property ticked with the back, next, cancel, and finish buttons.

Figure 3-315

The Enable this subscription flag property is ticked and Next> clicked

A screenshot of new subscription tab with highlighted button that reads finish. Under it a table for summary with 2 columns of name and value is given with several rows.

Figure 3-316

The parameters for creation of the Workflow Subscription are displayed

A screenshot of new subscription tab with highlighted button that reads close. Under it successful creation of A U D underscore send J M S message launch workflow has been given with its time data. "

Figure 3-317

The status of the Workflow subscription Object creation is shown

Testing the Updated Audit Master Solution

After transferring the Workflow, we can now test the Audit Report triggering document class creation, by launching the Audit Master solution in the IBM Case Builder test environment.

A screenshot of I B M case manager builder window with highlighted play button on the bottom right of a box that reads audit master. The box is under a search bar. "

Figure 3-318

The highlighted triangle icon is clicked to launch the IBM Case Manager

A screenshot of I B M case manager window with highlighted option audit department from drop down of add case under cases tab.

Figure 3-319

An Audit Department Case is added with the Case Manager Audit Solution

A screenshot of the I B M case manager for case details with business objects of the audit department. Under documents tab on the page add documents from local system is highlighted under drop down of add tab.

Figure 3-320

The Add Document from Local System Document add option is selected

A screenshot of I B M case manager window with audit report document class selected and highlighted from the list under properties.

Figure 3-321

The Audit Report Document Class is selected from the list

A screenshot of I B M case manager where general and properties tabs have highlighted texts for the audit report.

Figure 3-322

The property details for the Audit Report Document are entered

A screenshot represents to add of the document in the audit report and the add button is highlighted.

Figure 3-323

The Add command button is used to create the Audit Report document

A screenshot of case details with business objects for audit department. The highlighted text is J M S message trigger under home section.

Figure 3-324

The new Document, JMS Message Trigger, is displayed in the Case

A screenshot of a message browser window with queue manager name A U D Q M and queue name A U D Q A R. A table below has 6 columns and 8 rows. July 7, 2022 and Web sphere M Q client for java is highlighted in the row 8 while the whole row is selected.

Figure 3-325

A new JMS message can be seen in the IBM MQ AUDQAR queue

A screenshot of message 8 properties with data option selected in the left panel and test message on 7th July 2022 is highlighted in the right panel.

Figure 3-326

The Message data from the Workflow JMS component call

A screenshot of process administrator with highlighted titles labeled, events, event log at the top. A table with 11 columns and 8 rows where F underscore operation i d, F underscore comment, and F underscore subject are selected.

Figure 3-327

The F_Comment and F_Subject fields are in the Workflow Events

Chapter 3 Exercises

The following questions relate to the sendJMSMessage Java Component Integrator method developed for use with the IBM Process Designer Workflow subscriptions and the Case Manager, Audit Master Solution, which we cover in this chapter.

MULTIPLE CHOICE QUESTIONS
  1. 1.
    What script would you run to accept the IBM MQ 9.2.x license before installation?
    1. a)

      pedesigner.bat

       
    2. b)

      cmd.exe

       
    3. c)

      mqlicense.sh

       
    4. d)

      amqsputc

       
     
  2. 2.

    What is the solution if you get the following JMS Java message:

     
"the class com.ibm.mq.jms.MQQueue cannot be cast to javax.jms.ConnectionFactory"?
  1. a)

    A queue connection factory must be defined as a WebSphere MQ Connection Factory.

     
  2. b)

    A queue connection factory must be defined as a WebSphere MQ Queue Connection Factory.

     
  3. c)

    Use a javax.jms.QueueConnectionFactory object.

     
  4. d)

    Use the Java code: TextMessage outMessage = JMSsession.createTextMessage();

     
  1. 3.

    What change do you need to make if you get the Java runtime error in Eclipse as follows:

     
"JVMCFRE003 bad major version; class=com/ibm/filenet/ps/ciops/test/AUDOperationsTest, offset=6" ?
  1. a)

    Add the JMS Message library, javax.jms-api-2.0.1.jar, to the Eclipse IDE classpath.

     
  2. b)

    Add two new lines to the /etc/security/limits.conf file; @root soft nofile 10240 and @root hard nofile 16384.

     
  3. c)

    Change the JVM version in the Eclipse project from 1.7 to 1.8.

     
  4. d)

    Add jars from the /opt/MQJars folder to the Eclipse Classpath.

     
  1. 4.

    The main purpose of a Workflow Subscription is

     
  1. a)

    To enable the creation of a Folder Object

     
  2. b)

    To enable the creation of a Document Object

     
  3. c)

    To enable a workflow to be launched on the storage of a document

     
  4. d)

    To enable a Case to be created in IBM Case Manager

     
MULTIPLE CHOICE ANSWERS
  1. 1.

    c) mqlicense.sh

     
  2. 2.

    b) A queue connection factory must be defined as a WebSphere MQ Queue Connection Factory.

     
  3. 3.

    c) Change the JVM version in the Eclipse project from 1.7 to 1.8.

     
  4. 4.

    c) To enable a workflow to be launched on the storage of a document

     
QUESTIONS
  1. 1.

    Describe what steps you would use to install a new Component Integrator, given that you have been given a working AUDOperations.jar file and have been asked to configure a sendJMSMessage custom operations method call step in a Workflow.

     
  2. 2.

    What security group(s) do you need to have to run the IBM MQ Explorer program and what commands would you need to run to use this from a Unix command window?

     
  3. 3.

    What Java libraries would you install in an Eclipse IDE Classpath to develop a Component Integrator Java class and where would you find them?

     

In Chapter 4, we will cover the use of the Java language for the IBM FileNet Java API calls and the configuration required to replicate an IBM FileNet Document Management Object Store.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.198.138