Introduction
JMS stands for Java Message Service. It is an API used to exchange messages among applications. The ReadyAPI supports Java Message Service so that you can send and receive both text and binary messages. To understand JMS better, we need to understand every aspect of it.
In this blog, we will discuss two important modules of JMS. These are creating the connector plugin and working with JMS in Ready API. So, without wasting time, let’s get started.
Creating the Connector Plugin in Ready API
As the name suggests, the connector plugin permits direct connections to JMS brokers. It serves as a way to provide the JMS client libraries to ReadyAPI. The plugins come with template values used to form connections with ReadyAPI. You can alter the template values but cannot change the initial context class in the UI.
Pre-preparation
You need to keep a check on the following items before you start the process of creation.
- Java libraries to form a connection with the JMS provider
- JDK installed and configured
- Initial Context Class name
- Provider URL
- Connection Factory JNDI name
Creation of Connector Plugin
To create a connector plugin, follow these steps.
1. Create an empty folder in file explorer. This folder will become the root folder for the plugin.
2. Create a subfolder and name it lib in the created directory.
3. Copy all the JMS client libraries in the .jar format to the created subfolder. If the client libraries depend on other libraries, copy those libraries as well.
4. Now, download the jms-plugin.properties file from the official website.
5. Save the properties files to the root folder of the plugin. The file structure is given below for your reference.
<Plugin root folder>
|--lib
|--<Provider’s jar files>
|--jms-plugin.properties
6. Open the properties file in any text editor to edit the default values. Use the comments in that file to understand the properties.
7. Some properties impact the plugin’s working and its representation in the interface. We will configure the properties. A brief description of these properties is given below in the table.
Property |
Description |
plugin.name | This property does not affect your tests. It is the name of the plugin displayed in the Plugin Manager. |
plugin.version | This property also does not affect your tests. It is the version of the plugin displayed in the Plugin Manager. |
plugin.description | It is the description of the plugin displayed in the Plugin Manager. Also, it does not affect your tests. |
plugin.autodetect |
It mandates ReadyAPI to look for plugin components used in Custom Plugins. If true, you can add custom elements to the plugin along with loading client libraries. If false, you will only be able to load JMS client libraries. |
minimum.ready.version | It shows the minimum supported version of ReadyAPI. All versions below to this are unsupported. You will not be able to load the plugin in such versions. |
connector.label | This property contains the label used to select the plugin in ReadyAPI Interface. |
8. Also, there are a few properties that impact the working of the plugin with the JMS provider. While configuring those properties, you might need to add some values you got when configuring the JMS provider. A detailed description of these properties is given below.
- initial.context.class.name
The plugin uses this property to form connections with the JMS provider. You can find the context factory property in the JMS provider documentation. Use the example classes name for JMS providers given below.
JMS providers |
Classes |
Oracle Weblogic | weblogic.jndi.WLInitialContextFactory |
TIBCO EMS | com.tibco.tibjms.naming.TibjmsInitialContextFactory |
Active MQ | org.apache.activemq.jndi.ActiveMQInitialContextFactory |
WebSphere MQ | You will get this value from the Initial Context Factory property while configuring the WebSphere MQ installation. |
- provider.url.template
By default, this property specifies the URL of the service suggested by the plugin. You can change it at any point.
JMS providers |
Classes |
TIBCO EMS | tcp://<hostname>:61616 |
Active MQ | tibjmsnaming://<hostname>:7222 |
WebSphere MQ | You will get this value from the Provider URL property while configuring the WebSphere MQ installation. |
- connection.factory.name.template
This property is used to form connections with the JMS broker.
JMS providers |
Classes |
Active MQ | ConnectionFactory |
WebSphere MQ | You will get this value from the Connection Factory property while configuring the WebSphere MQ installation. |
9. At last, build the plugin. There are two ways to do it.
By using JDK
Firstly, create a Java Archive (JAR) file using jar utility. Now, open the command prompt shell and move to the plugin’s root folder. Run the following command.
jar cvf my-jms-connector-plugin.jar *
By using a file archiver
Firstly, create a zip archive using jms-plugin.properties file and the lib folder. Note that you do not need to archive the root folder. This can lead to wrong structure and invalid plugins. An example of a valid plugin is given below.
my-jms-connector-plugin.zip
|--lib
|--<Provider’s jar files>
|--jms-plugin.properties
Lastly, change the extension to .jar.
10. Once you have a final .jar file, install it as mentioned.
Firstly, open the Integrations Tab. Click on the Install from file option and start browsing for the required plugin file. Select it, click Open and wait for the process to complete. A window appears; click Ok. If needed, restart the ReadyAPI.