• Stars
    star
    177
  • Rank 215,985 (Top 5 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created almost 7 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Components to assist MQ JMS integration with Spring frameworks

IBM MQ JMS Spring Components

This repository contains code to help to provide Spring developers with easy configuration of the IBM MQ JMS package.

The library contains:

Installation and Usage

The compiled versions of this package can be automatically downloaded from Maven Central.

For local modifications and building it yourself, you can use the RUNME.sh script. It uses gradle as the build mechanism and has tasks that can push compiled jars to either a local repository (typically under $HOME/.m2) or to Maven Central. When signing/authentication of modules is required, use the gradle.properties.template file as a starter for your own gradle.properties.

Java 17 is required as the compiler level when building this package, as that is the baseline for Spring 3.

The script builds modules for both the JMS2 and JMS3 standards. The JMS3 (Jakarta) variant does not have a separate source tree in this repository. Instead, the source is generated automatically during the build process, by simply changing package names in the JMS2 code. The created jar files have the same names, but different version numbers.

Spring Boot Applications

Gradle:

repositories {
   mavenLocal()
   mavenCentral()
}

dependencies {
    compile group: 'com.ibm.mq', name: 'mq-jms-spring-boot-starter', version: 'x.y.z'
}

Maven:

<dependency>
  <groupId>com.ibm.mq</groupId>
  <artifactId>mq-jms-spring-boot-starter</artifactId>
  <version>x.y.x</version>
</dependency>

Note This repository and the corresponding Maven Central artifacts require either Spring Boot 2 or 3.

Design Approach

The approach taken here is to follow the model for JMS applications shown in the Spring Getting Started Guide for JMS. That in turn is based on using the JmsTemplate Framework

Some simple example programs using Spring Boot and JMS interfaces can be found in the samples directory. The RUNME.sh program in each subdirectory compiles and executes it. The application.properties files in that tree may need modification for your environment.

Essentially what gets configured from this package are a ConnectionFactory which Spring's JmsTemplate implementation exploits to provide a simpler interface, and a MessageListener.

Getting Started

To get started quickly, you can use the default configuration settings in this package along with the IBM MQ for Developers container which runs the server processes.

Default Configuration

The default options have been selected to match the MQ Docker container development configuration.

This means that you can run a queue manager using that Docker environment and connect to it. This script will run the container on a Linux system.

docker run --env LICENSE=accept --env MQ_QMGR_NAME=QM1 \
           --publish 1414:1414 \
           --publish 9443:9443 \
           --detach \
           ibmcom/mq

The default attributes are

ibm.mq.queueManager=QM1
ibm.mq.channel=DEV.ADMIN.SVRCONN
ibm.mq.connName=localhost(1414)
ibm.mq.user=admin
ibm.mq.password=passw0rd

Connection security

The default userid and password have been chosen for a commonly-used queue manager configuration.

To disable user/password checking entirely, you must set the ibm.mq.user attribute to an empty value so that the default is not used.

   ibm.mq.user=

Of course, that level of access must be permitted by your queue manager. The usual CHLAUTH and CONNAUTH rules will apply to assign an identity to the connection.

Configuration of secure connections with TLS are discussed below.

Configuration Options

If you already have a running MQ queue manager that you want to use, then you can easily modify the default configuration to match by providing override values.

The queue manager name is given as

  • ibm.mq.queueManager

For client connections to a queue manager, you must also have either

  • ibm.mq.channel
  • ibm.mq.connName or
  • ibm.mq.ccdtUrl

If both the channel and connName are empty, and the CCDTURL is not supplied, then a local queue manager is assumed. The CCDTURL property is taken in preference to the channel and connName. The channel and connName have non-blank defaults, so must be explicitly set to empty strings if you do not wish them to be used.

Optionally you can provide a client id and application name if required.

  • ibm.mq.clientId
  • ibm.mq.applicationName

You will probably also need to set

  • ibm.mq.user
  • ibm.mq.password

to override the default values.

For example in an application.properties file:

ibm.mq.queueManager=QM1
ibm.mq.channel=SYSTEM.DEF.SVRCONN
ibm.mq.connName=server.example.com(1414)
ibm.mq.user=user1
ibm.mq.password=passw0rd

Spring Boot will then create a ConnectionFactory that can then be used to interact with your queue manager.

Option Description
ibm.mq.queueManager Name of queue manager
ibm.mq.channel Channel Name for SVRCONN
ibm.mq.connName Connection Name, which can be comma-separated list
ibm.mq.ccdtUrl Location of the MQ CCDT file (URL can reference http/ftp location)
ibm.mq.user User Name. Must be set to an empty value to turn off authentication attempts
ibm.mq.password Password
ibm.mq.clientId ClientId uniquely identifies the app connection for durable subscriptions
ibm.mq.applicationName Application Name used for Uniform Cluster balancing
ibm.mq.userAuthenticationMQCSP Control authentication mechanism for old queue managers (default true)
ibm.mq.tempQPrefix The prefix to be used to form the name of an MQ dynamic queue
ibm.mq.tempTopicPrefix The prefix to be used to form the name of an MQ dynamic topic
ibm.mq.tempModel The name of a model queue for creating temporary destinations.
ibm.mq.reconnect Whether app tries automatic reconnect. Options of YES/NO/QMGR/DISABLED/DEFAULT
ibm.mq.autoConfigure If explicitly set to "false", then the autoconfigure bean is disabled

The reconnect option was previously named defaultReconnect but both names work in the configuration.

TLS related options

The following options all default to null, but may be used to assist with configuring TLS

Option Description
ibm.mq.sslCipherSuite Cipher Suite, sets connectionFactory property WMQConstants.WMQ_SSL_CIPHER_SUITE
ibm.mq.sslCipherSpec Cipher Spec, sets connectionFactory property WMQConstants.WMQ_SSL_CIPHER_SPEC
ibm.mq.sslPeerName Peer Name, sets connectionFactory property WMQConstants.WMQ_SSL_PEER_NAME
ibm.mq.useIBMCipherMappings Sets System property com.ibm.mq.cfg.useIBMCipherMappings
ibm.mq.outboundSNI Sets property com.ibm.mq.cfg.SSL.OutboundSNI (use HOSTNAME for Openshift qmgrs)
ibm.mq.channelSharing Sets strategy for TCP/IP connection sharing - CONNECTION or GLOBAL

We also have

Option Description
ibm.mq.sslFIPSRequired Force FIPS-compliant algorithms to be used (default false)
ibm.mq.sslKeyResetCount How many bytes to send before resetting the TLS keys

Caching connection factory options

You may want to use the default Spring Caching connection factory with the default Spring JMS properties. This is now the preferred method in Spring for holding JMS objects open, rather than the Pooling options described below.

Option Description
spring.jms.cache.enabled Whether to cache sessions
spring.jms.cache.consumers Whether to cache message consumers
spring.jms.cache.producers Whether to cache message producers
spring.jms.cache.session-cache-size Size of the session cache (per JMS Session type)

Pooled connection factory options

Alternatively you may configure a pooled connection factory by using those properties:

Option Description
ibm.mq.pool.enabled Enabled Pooled connection factory usage
ibm.mq.pool.blockIfFull Blocks a connection request when the pool is full. Default is false
ibm.mq.pool.blockIfFullTimeout Blocking period before throwing an exception if the pool is still full
ibm.mq.pool.idleTimeout Connection idle timeout. Default to 30 seconds
ibm.mq.pool.maxConnections Maximum number of pooled connections. Default is 1
ibm.mq.pool.maxSessionsPerConnection Maximum number of pooled sessions. Default is 500
ibm.mq.pool.timeBetweenExpirationCheck Time to sleep between runs of the idle connection eviction thread. Disable when negative. Default is -1
ibm.mq.pool.useAnonymousProducers Whether to use only one anonymous "MessageProducer" instance. Set it to false to create one "MessageProducer" every time one is required

These pooling options make use of the PooledJMS implementation. More documentation on the options can be found here.

JMS Polling Listener Timer configuration

The Spring AbstractPollingMessageListenerContainer interface has a default polling timer of 1 second. This can now be configured with the spring.jms.listener.receiveTimeout property. If the property is not explicitly set, then this MQ Spring Boot component resets the initial timeout value to 30 seconds which has been shown to be more cost-effective. Application code can still set its own preferred value.

Option Description
spring.jms.listener.receiveTimeout How frequently to poll for received messages. Default is 1s. Given as a Duration string: "1m", "60s", "60000" are equivalent

Additional properties

Additional properties that are not in the recognised sets listed here can be put onto the Connection Factory via a map in the external properties definitions. Use the format ibm.mq.additionalProperties.CONSTANT_NAME=value. The CONSTANT_NAME can be either the real string for the property, and will often begin with "XMSC", or it can be the variable as known in the WMQConstants class.

For example, the constant WMQConstants.WMQ_SECURITY_EXIT has the value "XMSC_WMQ_SECURITY_EXIT" and can be written in the properties file either as ibm.mq.additionalProperties.XMSC_WMQ_SECURITY_EXIT=com.example.SecExit or as ibm.mq.additionalProperties.WMQ_SECURITY_EXIT=com.example.SecExit

There is no error checking on the property name or value. This may help with enabling rarely-used properties and reduce the need for a customizer method in application code. See the KnowledgeCenter for a list of all the currently-recognised properties that may be set on a CF - though note that many are now deprecated.

If the value looks like a number, it is treated as such. You can use hex constants beginning "0X" or decimals for a number. Similarly if the value is TRUE/FALSE then that is processed as a boolean. So you cannot try to set a string property that appears to be an integer. Symbols representing the value of integer attributes cannot be used - the real number must be given.

JNDI

Spring already has configuration parameters for the use of a JNDI repository with a JMS program. See the Spring documentation for more details.

However this package also enables some simple use of JNDI for Connection definitions (but not Destinations, as they are still always handled by the core Spring classes).

You can set the ibm.mq.jndi.providerUrl and ibm.mq.jndi.providerContextFactory attributes to define how the lookup is to be carried out. For example,

  ibm.mq.jndi.providerUrl=file:///home/username/mqjms/jndi
  ibm.mq.jndi.providerContextFactory=com.sun.jndi.fscontext.RefFSContextFactory

If you choose to use this mechanism, all of the other queue manager properties that might be defined in your resource definitions are ignored and not traced in order to avoid confusion. They will instead be picked up from the ConnectionFactory definition in JNDI. The queueManager property is then more accurately used as the ConnectionFactory name used as the lookup. If you are using an LDAP JNDI provider, then the CF name will be modified if necessary to always begin with cn=.

The ibm.mq.jndi.additionalProperties prefix can be used for any other JNDI-related properties that need to be applied to the Context object. The symbolic name of the field from that Java class can be used. For example,

ibm.mq.jndi.additionalProperties.SECURITY_CREDENTIALS=passw0rd

results in

  env.put(Context.SECURITY_CREDENTIALS,"passw0rd")

The MQConnectionFactoryFactory.getJndiContext method is public so you can use it with your own constructed properties object and get access to a JNDI Context object - it might make it easier to work with Destinations if you can reuse the same way of getting directory access.

Logging & Tracing

The package makes use of the logging capabilities within Spring. You can enable tracing of this specific component in your application's properties file by setting logging.level.com.ibm.mq.spring.boot=TRACE. Otherwise it uses the standard inheritance of logging configuration from logging.level.rootdownwards.

Related documentation

Contributions and Pull requests

Contributions to this package can be accepted under the terms of the Developer's Certificate of Origin, found in the DCO file of this repository. When submitting a pull request, you must include a statement stating you accept the terms in the DCO.

Using in Other Projects

The preferred approach for using this package in other projects will be to use the Gradle or Maven dependency as described above.

License

Copyright © 2018, 2023 IBM Corp. All rights reserved.

Licensed under the apache license, version 2.0 (the "license"); you may not use this file except in compliance with the license. You may obtain a copy of the license at

http://www.apache.org/licenses/LICENSE-2.0.html

Unless required by applicable law or agreed to in writing, software distributed under the license is distributed on an "as is" basis, without warranties or conditions of any kind, either express or implied. See the license for the specific language governing permissions and limitations under the license.

Health Warning

This package is provided as-is with no guarantees of support or updates. You cannot use IBM formal support channels (Cases/PMRs) for assistance with material in this repository. There are also no guarantees of compatibility with any future versions of the package; the API is subject to change based on any feedback. Versioned releases are made to assist with using stable APIs.

Issues

Before opening a new issue please consider the following:

  • Please try to reproduce the issue using the latest version.
  • Please check the existing issues to see if the problem has already been reported. Note that the default search includes only open issues, but it may already have been closed.
  • When opening a new issue here in github please complete the template fully.

More Repositories

1

mq-container

Container images for IBM® MQ
Go
212
star
2

mq-dev-patterns

Code samples and messaging patterns for IBM MQ developers
JavaScript
181
star
3

mq-golang

Calling IBM MQ from Go applications
Go
157
star
4

mq-docker

[DEPRECATED] Sample Docker image for IBM® MQ
Shell
125
star
5

event-streams-samples

Java
91
star
6

kafka-connect-mq-source

This repository contains a Kafka Connect source connector for copying data from IBM MQ into Apache Kafka.
Java
86
star
7

mq-mqi-nodejs

Calling IBM MQ from Node.js - a JavaScript MQI wrapper
JavaScript
74
star
8

mq-dev-samples

Samples for getting started with IBM MQ
Java
62
star
9

mq-metric-samples

IBM® MQ metric gathering client samples
Go
58
star
10

kafka-java-vertx-starter

Starter Java app for testing connection to Apache Kafka with Vert.x
JavaScript
44
star
11

mq-rfhutil

Message creation, editing and replay to help test MQ and IIB/ACE applications. Previously released as IH03 RFHUTIL SupportPac
C++
42
star
12

kafka-connect-jdbc-sink

This repository contains a Kafka Connect sink connector for copying data from Apache Kafka into databases using JDBC.
Java
34
star
13

mqtt-ios-sample

Sample iOS app using MQTT
Objective-C
34
star
14

mq-ansible

Ansible roles for IBM MQ
Python
30
star
15

mq-helm

Smarty
28
star
16

kafka-connect-mq-sink

This repository contains a Kafka Connect sink connector for copying data from Apache Kafka into IBM MQ.
Java
28
star
17

mq-golang-jms20

JMS style messaging interface for Golang applications connecting to IBM MQ
Go
26
star
18

mqperf

Repository for MQ related performance documents
22
star
19

mqlight-docker

Docker image for IBM MQ Light
Shell
22
star
20

mq-aws

Sample code for running IBM® MQ on Amazon Web Services (AWS)
Shell
21
star
21

kafka-connect-rabbitmq-source

This repository contains a Kafka Connect source connector for copying data from RabbitMQ into Apache Kafka.
Java
19
star
22

message-hub-rest

JavaScript
17
star
23

mq-q-qload

This repository contains the code from IBM MQ SupportPacs MA01 (q) and MO03 (qload)
C
17
star
24

mqtt-PickMeUp

Objective-C
16
star
25

mq-dev-badge-sample

Sample code of the MQ developer essentials badge
HTML
13
star
26

mq-chef

Chef cookbook for installing and configuring IBM® MQ
Ruby
13
star
27

mq-container-mft

Samples for integrating MQ MFT in Cloud scenarios
Go
13
star
28

mq-azure

This repository contains information and samples etc. relating to using IBM MQ on Microsoft Azure
Shell
12
star
29

mq-rdqm

Repository for the Replicated Data Queue Manager feature of IBM MQ
PowerShell
11
star
30

mq-tls-ssl-wizard

A wizard to help configure your MQ SSL/TLS connections
Java
11
star
31

mq-cph

The IBM MQ C Performance Harness
C++
10
star
32

mq-rexx-api

A REXX interface to issue MQ API calls - previously known as Supportpac MA95
C
9
star
33

mq-mqsc-editor-plugin

A plug-in for the MQ Explorer to help edit and execute MQSC scripts
HTML
8
star
34

mq-exits

A collection of sample IBM MQ exits
C
8
star
35

mqldt

IBM MQ Log Disk Tester
C
8
star
36

mq-appliance

This repository contains information and samples relating to the IBM MQ Appliance
Perl
7
star
37

mq-camel

A place for samples that describes IBM MQ and Apache Camel integration
Java
7
star
38

mq-openstack

Sample code for running IBM® MQ on OpenStack
Shell
6
star
39

kafka-connect-ibmcos-sink

This repository contains a Kafka Connect sink connector for copying data from Apache Kafka into IBM Cloud Object Storage
Java
6
star
40

mqlight-fishalive-node

Node.js MQ Light fishalive sample
JavaScript
6
star
41

jmstestp

Environment for creating a docker image running jms performance tests for Persistent and Non Persistent messaging.
Shell
6
star
42

mq-mft

Repository for IBM MQ Managed File Transfer documents, samples etc
Java
6
star
43

mq-event-display

Java
6
star
44

mq-cloud-demo

Sample scenario and applications for demonstrating the IBM MQ on Cloud service
JavaScript
6
star
45

mq-dotnet-administration-with-mqrestapi

This repository provides .NET samples which help in doing basic IBM MQ Queue/Channel Administration using IBM MQ REST API's
C#
6
star
46

cphtestp

Environment for creating a docker image running cph performance tests for Persistent and Non-Persistent messaging against an MQ Queue Manager.
Shell
6
star
47

mq-smf-csv

Simple formatter for MQ's SMF records to assist with import to spreadsheets and databases
C
6
star
48

mq-dotnet-samples

C#
5
star
49

cp4i-mq-samples

Samples to showcase connecting to a queue manager running as part of IBM Cloud Pak for Integration
Shell
5
star
50

macaque

Flask style library for microservices with MQ Light
Python
5
star
51

mq-cluster-tool

A tool to query and visualize your IBM MQ Clusters using a graph
Java
5
star
52

mq-atom-mqsc

Repository for the MQSC syntax hightlighting code used in the Atom text editor
5
star
53

kafka-connect-xml-converter

A Kafka Connect plugin to make it easier to work with XML data in Kafka Connect pipelines
Java
5
star
54

kafka-connect-elastic-sink

Kafka Connector to deliver events into Elasticsearch
Java
4
star
55

mq-wlm-client

Java
4
star
56

seneca-mqlight-transport

DEPRECATED: Implementation of a transport layer for using MQ Light with the Seneca microservices framework
JavaScript
4
star
57

mft-sample-web-ui

IBM MQ Managed File Transfer REST API
JavaScript
4
star
58

mq-python-json

Repo showing example(s) of how to consume and parse MQ event messages in Python
Python
4
star
59

mqlight-worker-thread

This repository contains a lab based on the worker thread use case for MQ Light
JavaScript
4
star
60

mq-sample-web-ui

A sample web page that uses the MQ administrative REST API
JavaScript
4
star
61

event-streams-docs

4
star
62

mq-asyncapi-java-template

This repository is no longer used and the project is now hosted within the ASyncAPI organisation.
JavaScript
4
star
63

ms03.saveqmgr

ms03-saveqmgr
C
3
star
64

mqlight-sentiment-sample

Files for MQ Light Lab at Impact
PHP
3
star
65

mqtt-smartboard

Java
3
star
66

mq-rexx-utils

This tool provides rexx execs to take output from CSQUTIL or runmqsc and create HTML pages so you can compare and contrast the differences on MQ object and their attributes. Differences are highlighted. You can display all attributes, or just different attributes.
HTML
3
star
67

mqlight-python-bluemix

MQ Light Python sample for Bluemix
HTML
3
star
68

mq-ansible-yaml-commands

IBM MQ Ansible Collection to issue YAML form commands to MQ queue managers
2
star
69

mq-ssl

This repository will contain a Wiki describing how to configure SSL with MQ in a couple of scenarios.
2
star
70

mq-pvc-tool

A tool for inspecting the Persistent Volume Claims associated with Queue Manager pods on OpenShift
Shell
2
star
71

mq-mi

Repository for information, samples etc. relating to IBM MQ Multi Instance queue manager support
C
2
star
72

mq-sfbridge-demo

IBM MQ Salesforce bridge demo in Docker
Shell
2
star
73

mqlight-fishalive-ruby

Ruby MQ Light fishalive sample
HTML
2
star
74

mqldt-c

Containerized version of mqldt
Dockerfile
2
star
75

mqtt-home-automation

This repository will contain an example of using MQTT to publish information about a house and controlling some aspects by publishing MQTT messages
2
star
76

iperf3-client

Configuration to build and run iperf3 client images
Dockerfile
2
star
77

ibm-messaging.github.io

WebSite for IBM Messaging
CSS
2
star
78

mq-ibmcloud

Sample code for running IBM® MQ on IBM Cloud (e.g. Bluemix / SoftLayer)
Java
2
star
79

mq-scratch-extension

Repo hosting the ScratchX.org extension for IBM MQ using the IBM MQ REST API
JavaScript
2
star
80

mq-mqfts

IBM MQ Managed File Transfer Log Capture Utility
Go
2
star
81

mqtt-status-pattern

This repository contains an example showing a pattern of usage of MQTT that makes available the status of MQTT clients.
C
2
star
82

kafka-connect-weather-source

This repository contains a Kafka Connect source connector for importing data from the IBM Weather Service into Apache Kafka.
Java
2
star
83

MFT-REST-java-sample

Java
2
star
84

homebrew-ibmmq

Homebrew tap for IBM MQ formulae and casks
Ruby
2
star
85

mq-mft-file-ordering

File Ordering MQMFT Exit
Java
1
star
86

mq-mft-REST-Samples

Go
1
star
87

iperf3-server

Configuration to build iperf3 images
Dockerfile
1
star
88

mq-raspberry-pi-developers

1
star
89

event-streams-operator-resources

1
star
90

mqtt-android-helper

Java
1
star
91

mqlight-fishalive-java

Java MQ Light fishalive sample
Java
1
star
92

mqlight-interconnect-2015-lab

Materials for the MQ Light Interconnect 2015 lab
HTML
1
star
93

messagesight-oauth-sample

Java
1
star
94

mqlight-conference-lab

Materials for demonstrating the use of the MQ Light API at conferences
HTML
1
star
95

mq-uniform-clusters

MQ Uniform Clusters bring a set of queue managers together to work as a single unit to intelligently distribute the applications across them. This repository provides simple scripts and setup to get going quickly
C
1
star
96

messagesight-message-expiry

This repository contains an example of using JMS to publish a message to MessageSight with a time to live and seeing that applied when there is an MQTT subscriber.
Java
1
star