{"id":1190,"date":"2010-11-24T00:14:24","date_gmt":"2010-11-23T18:44:24","guid":{"rendered":"http:\/\/naveenbalani.com\/?p=1190"},"modified":"2016-09-17T19:15:55","modified_gmt":"2016-09-17T13:45:55","slug":"introduction-to-ibm-mqseries-and-triggering","status":"publish","type":"post","link":"https:\/\/navveenbalani.dev\/index.php\/articles\/introduction-to-ibm-mqseries-and-triggering\/","title":{"rendered":"Introduction to IBM MQSeries and Triggering"},"content":{"rendered":"<p>In this blog , I would provide an introduction to MQSeries messaging and triggering concepts.<\/p>\n<p><strong style=\"font-weight: bold;\">1. Basic MQSeries messaging concepts<\/strong><br \/>\n<strong style=\"font-weight: bold;\">Queuing<\/strong><\/p>\n<p><em style=\"font-style: italic;\">Queuing<\/em> is the mechanism by which messages are held until an application is ready to process them. Queuing allows you to:<\/p>\n<ul>\n<li>Communicate between programs (which may be running in different environments) without having to write communication code.<\/li>\n<li>Select the order in which a program processes messages.<\/li>\n<li>Balance loads by arranging for more than one program to service a queue when the number of messages exceeds a threshold.<\/li>\n<\/ul>\n<p>A <em style=\"font-style: italic;\">message queue<\/em>, known simply as a <em style=\"font-style: italic;\">queue<\/em>, is a named destination to which messages can be sent. Messages accumulate on a queue until they are retrieved by a program that services that queue. The physical nature of a queue depends on the operating system on which the queue manager is running.<\/p>\n<p>Queues reside in and are managed by a <em style=\"font-style: italic;\">queue manager, <\/em>which is a system program that provides queuing services to applications. It provides an application programming interface so that programs can put messages on queues and get messages from them.<\/p>\n<p><strong style=\"font-weight: bold;\">Channels<\/strong><\/p>\n<p><em style=\"font-style: italic;\">Channels<\/em> are communication links used by distributed applications. There are two categories of channels in MQSeries:<\/p>\n<ul>\n<li><em style=\"font-style: italic;\">Message channels<\/em>, which are unidirectional, and transfer messages from one queue manager to another.<\/li>\n<li><em style=\"font-style: italic;\">MQI channels<\/em>, which are bi-directional, and transfer calls from an MQSeries client to a queue manager, and responses from a queue manager to an MQSeries client.<\/li>\n<\/ul>\n<p><strong style=\"font-weight: bold;\">Triggering<\/strong><\/p>\n<p>The queue manager defines certain conditions as <em style=\"font-style: italic;\">trigger events<\/em>. If triggering is enabled for a queue and a trigger event occurs, the queue manager sends a trigger message to a queue called an <em style=\"font-style: italic;\">initiation queue<\/em>. The presence of the trigger message on the initiation queue indicates that a trigger event has occurred. Trigger messages generated by the queue manager are not persistent.<\/p>\n<p>The program that processes the initiation queue is called a <em style=\"font-style: italic;\">trigger-monitor application<\/em>, and its function is to read the trigger message and take appropriate action based on the information in the trigger message. Normally this action is to start some other application to process the queue that generated the trigger message. From the point of view of the queue manager, there is nothing special about the trigger-monitor application &#8212; it is simply another application that reads messages from a queue (the initiation queue).<\/p>\n<p>If triggering is enabled for a queue, you can create a <em style=\"font-style: italic;\">process-definition object<\/em> associated with it. This object contains information about the application that processes the message that caused the trigger event. If the process definition object is created, the queue manager extracts this information and places it in the trigger message, for use by the trigger-monitor application. The name of the process definition associated with a queue is given by the ProcessName local-queue attribute. Each queue can specify a different process definition, or several queues can share the same process definition.<\/p>\n<p>To a queue manager, a trigger monitor is like any other application that serves a queue, except that it serves only initiation queues. A trigger monitor is usually a continuously running program. When a trigger message arrives on an initiation queue, the trigger monitor retrieves that message. It uses information in the message to issue a command to start the application that processes the messages on the application queue.<\/p>\n<p><strong>2. Scenario<\/strong><br \/>\nTo get the concepts clear, we will build a sample application that takes orders from customers and then, when the number of orders reaches a maximum value, the system processes and dispatches the order. Users can track their orders using a link on the home page. Using MQSeries as the middleware, the application will store orders on a queue (App.OrderQ), then trigger a predefined event (a Java program) to process the orders and update the process queue (App.ProcessQ), which enables customers to track their orders. This kind of application can be used for asynchronous processing.<!--more--><\/p>\n<p>The Index page is used by customers to place and track their orders. See Figure 1 below.<\/p>\n<p><strong>Figure 1.<a href=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2010\/11\/image01.jpg\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1191\" title=\"image01\" src=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2010\/11\/image01.jpg\" alt=\"image01\" width=\"514\" height=\"361\" srcset=\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2010\/11\/image01.jpg 514w, https:\/\/navveenbalani.dev\/wp-content\/uploads\/2010\/11\/image01-300x210.jpg 300w\" sizes=\"(max-width: 514px) 100vw, 514px\" \/><\/a><br \/>\n<\/strong><\/p>\n<p>When you click <strong>Place Your Order<\/strong>, you are presented with an Order page as shown in Figure 2 below.<\/p>\n<p><strong>Figure 2.<a href=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2010\/11\/image02.jpg\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1192\" title=\"image02\" src=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2010\/11\/image02.jpg\" alt=\"image02\" width=\"491\" height=\"369\" srcset=\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2010\/11\/image02.jpg 491w, https:\/\/navveenbalani.dev\/wp-content\/uploads\/2010\/11\/image02-300x225.jpg 300w\" sizes=\"(max-width: 491px) 100vw, 491px\" \/><\/a><br \/>\n<\/strong><\/p>\n<p>When you click <strong>Submit<\/strong>, the order servlet populates the order object (order bean), places it on the order queue, and generates an order number, which is displayed in Figure 3 below. The order number is used to track the order.<\/p>\n<p><strong>Figure 3.<a href=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2010\/11\/image03.jpg\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1193\" title=\"image03\" src=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2010\/11\/image03.jpg\" alt=\"image03\" width=\"480\" height=\"360\" srcset=\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2010\/11\/image03.jpg 480w, https:\/\/navveenbalani.dev\/wp-content\/uploads\/2010\/11\/image03-300x225.jpg 300w\" sizes=\"(max-width: 480px) 100vw, 480px\" \/><\/a><br \/>\n<\/strong><\/p>\n<p>To track an order, click <strong>Track Your Order<\/strong> on the main page, enter the order number, and click <strong>Submit<\/strong>. If the order placed on the order queue has not yet been triggered, you will receive the message shown in Figure 4 below. This is because the application specifies a Trigger Type of Depth and Trigger Depth of five in the properties associated with the App.Orderq queue, and therefore the trigger will not fire and update App.ProcessQ queue until there are five messages in the order queue.<\/p>\n<p><strong>Figure 4.<a href=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2010\/11\/image04.jpg\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1194\" title=\"image04\" src=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2010\/11\/image04.jpg\" alt=\"image04\" width=\"480\" height=\"360\" srcset=\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2010\/11\/image04.jpg 480w, https:\/\/navveenbalani.dev\/wp-content\/uploads\/2010\/11\/image04-300x225.jpg 300w\" sizes=\"(max-width: 480px) 100vw, 480px\" \/><\/a><br \/>\n<\/strong><\/p>\n<p>Figure 5 below shows a snapshot of the triggering event for App.OrderQ.<\/p>\n<p><strong>Figure 5.<a href=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2010\/11\/image05.jpg\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1195\" title=\"image05\" src=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2010\/11\/image05.jpg\" alt=\"image05\" width=\"493\" height=\"370\" srcset=\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2010\/11\/image05.jpg 493w, https:\/\/navveenbalani.dev\/wp-content\/uploads\/2010\/11\/image05-300x225.jpg 300w\" sizes=\"(max-width: 493px) 100vw, 493px\" \/><\/a><br \/>\n<\/strong><\/p>\n<p>Click <strong>Place Your Order <\/strong>four more times and enter four more orders. Then click <strong>Track Your Order <\/strong>and enter any one of the order numbers. You should see the message, as shown in Figure 6 below.<\/p>\n<p><strong>Figure 6.<a href=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2010\/11\/image06.jpg\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1196\" title=\"image06\" src=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2010\/11\/image06.jpg\" alt=\"image06\" width=\"493\" height=\"370\" srcset=\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2010\/11\/image06.jpg 493w, https:\/\/navveenbalani.dev\/wp-content\/uploads\/2010\/11\/image06-300x225.jpg 300w\" sizes=\"(max-width: 493px) 100vw, 493px\" \/><\/a><br \/>\n<\/strong><\/p>\n<p>This completes the application.<\/p>\n<p><strong>3. Setting up queues, channels, triggers, and process definitions for the queues in our application<\/strong><\/p>\n<p>You could set up queues using the MQSeries Explorer, which you can access via the MQSeries Program Menu or through MQ Commands. I have provided a setup file for our application.<\/p>\n<ol>\n<li>Extract the zip file <a href=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2010\/11\/mqapp.zip\">mqapp.zip<\/a> to a temporary location and run mqsetup.bat to set up queues, channels, triggers, and process definitions for our application.<\/li>\n<li>Add the path where MQSeries in installed (C:\\MQSeries\\bin) to your environment variable.<\/li>\n<li>Use MQSeries Explorer to see the queues and channels that have been created. You will see that a queue manager named Application.QManager has been created along with four queues: App.ErrorQ,App.InitiateQ, App.OrderQ, and App.ProcessQ, as shown in Figure 7 below.<\/li>\n<\/ol>\n<p><strong>Figure 7.<a href=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2010\/11\/image07.jpg\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1197\" title=\"image07\" src=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2010\/11\/image07.jpg\" alt=\"image07\" width=\"505\" height=\"371\" srcset=\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2010\/11\/image07.jpg 505w, https:\/\/navveenbalani.dev\/wp-content\/uploads\/2010\/11\/image07-300x220.jpg 300w\" sizes=\"(max-width: 505px) 100vw, 505px\" \/><\/a><br \/>\n<\/strong><\/p>\n<p>Expand the <strong>Advanced<\/strong> option of Application.QManager and click <strong>Channels<\/strong> to explore APP.Channel. Clients communicate to MQSeries through this channel. Click <strong>Process Definitions<\/strong> to see that the entry PERFORM.PROCESS has been created. Click PERFORM.PROCESS and select <strong>Properties<\/strong> and the window below opens. The Application Identifier specifies the Java program that we want to execute when the trigger fires. This process definition is associated with App.OrderQ.<\/p>\n<p><strong>Figure 8.<a href=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2010\/11\/image08.jpg\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1198\" title=\"image08\" src=\"http:\/\/naveenbalani.com\/wp-content\/uploads\/2010\/11\/image08.jpg\" alt=\"image08\" width=\"480\" height=\"360\" srcset=\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2010\/11\/image08.jpg 480w, https:\/\/navveenbalani.dev\/wp-content\/uploads\/2010\/11\/image08-300x225.jpg 300w\" sizes=\"(max-width: 480px) 100vw, 480px\" \/><\/a><br \/>\n<\/strong><\/p>\n<p>Click on <strong>Queues<\/strong> and select App.OrderQ. Click on it, select <strong>Properties<\/strong>, and then select the <strong>Triggering<\/strong> menu. The entries are described below.<\/p>\n<ul>\n<li>Trigger Control: On &#8212; Triggering is enabled.<\/li>\n<li>Trigger Type: Depth &#8212; Trigger will fire when Trigger Depth is reached.<\/li>\n<li>Trigger Depth: 5 &#8212; Trigger will fire when five messages are placed on the queue.<\/li>\n<li>Initiation Queue Name &#8212; Queue for temporarily holding the queued messages as described above under Triggering.<\/li>\n<li>Process Name: PERFORM.PROCESS &#8212; Process definition to execute when the trigger is fired.<\/li>\n<\/ul>\n<p>We have now set up the required queues, channels, and process definitions for our queue. In this application, the trigger fires only once when the trigger depth is reached. The trigger control is then automatically set to Off. The next step is to set up the Web interface for our application. In my next blog, we would go through setting up web interface for the application. This Tutorial of mine was first published by IBM developerWorks. All Rights reserved.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog , I would provide an introduction to MQSeries messaging and triggering concepts. 1. Basic MQSeries messaging concepts Queuing Queuing is the mechanism by which messages are held until an application is ready to process them. Queuing allows you to: Communicate between programs (which may be running in different environments) without having to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1197,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,142],"tags":[266,48,143],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v16.0.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Introduction to IBM MQSeries and Triggering - Current and Future Technology Trends by Navveen Balani<\/title>\n<meta name=\"description\" content=\"Introduction to IBM MQSeries and Triggering -\" \/>\n<link rel=\"canonical\" href=\"https:\/\/navveenbalani.dev\/index.php\/articles\/introduction-to-ibm-mqseries-and-triggering\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Introduction to IBM MQSeries and Triggering - Current and Future Technology Trends by Navveen Balani\" \/>\n<meta property=\"og:description\" content=\"Introduction to IBM MQSeries and Triggering -\" \/>\n<meta property=\"og:url\" content=\"https:\/\/navveenbalani.dev\/index.php\/articles\/introduction-to-ibm-mqseries-and-triggering\/\" \/>\n<meta property=\"og:site_name\" content=\"Current and Future Technology Trends by Navveen Balani\" \/>\n<meta property=\"article:published_time\" content=\"2010-11-23T18:44:24+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-09-17T13:45:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2010\/11\/image07.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"505\" \/>\n\t<meta property=\"og:image:height\" content=\"371\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"6 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/navveenbalani.dev\/#website\",\"url\":\"https:\/\/navveenbalani.dev\/\",\"name\":\"Current and Future Technology Trends by Navveen Balani\",\"description\":\"Current and Future Technology Trends by Navveen Balani\",\"publisher\":{\"@id\":\"https:\/\/navveenbalani.dev\/#\/schema\/person\/51f7ab14b20611d95e3c7fd4ea0950bf\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/navveenbalani.dev\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/introduction-to-ibm-mqseries-and-triggering\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2010\/11\/image07.jpg\",\"width\":\"505\",\"height\":\"371\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/introduction-to-ibm-mqseries-and-triggering\/#webpage\",\"url\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/introduction-to-ibm-mqseries-and-triggering\/\",\"name\":\"Introduction to IBM MQSeries and Triggering - Current and Future Technology Trends by Navveen Balani\",\"isPartOf\":{\"@id\":\"https:\/\/navveenbalani.dev\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/introduction-to-ibm-mqseries-and-triggering\/#primaryimage\"},\"datePublished\":\"2010-11-23T18:44:24+00:00\",\"dateModified\":\"2016-09-17T13:45:55+00:00\",\"description\":\"Introduction to IBM MQSeries and Triggering -\",\"breadcrumb\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/introduction-to-ibm-mqseries-and-triggering\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/navveenbalani.dev\/index.php\/articles\/introduction-to-ibm-mqseries-and-triggering\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/introduction-to-ibm-mqseries-and-triggering\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/navveenbalani.dev\/\",\"url\":\"https:\/\/navveenbalani.dev\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/introduction-to-ibm-mqseries-and-triggering\/\",\"url\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/introduction-to-ibm-mqseries-and-triggering\/\",\"name\":\"Introduction to IBM MQSeries and Triggering\"}}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/introduction-to-ibm-mqseries-and-triggering\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/introduction-to-ibm-mqseries-and-triggering\/#webpage\"},\"author\":{\"@id\":\"https:\/\/navveenbalani.dev\/#\/schema\/person\/51f7ab14b20611d95e3c7fd4ea0950bf\"},\"headline\":\"Introduction to IBM MQSeries and Triggering\",\"datePublished\":\"2010-11-23T18:44:24+00:00\",\"dateModified\":\"2016-09-17T13:45:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/introduction-to-ibm-mqseries-and-triggering\/#webpage\"},\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/navveenbalani.dev\/#\/schema\/person\/51f7ab14b20611d95e3c7fd4ea0950bf\"},\"image\":{\"@id\":\"https:\/\/navveenbalani.dev\/index.php\/articles\/introduction-to-ibm-mqseries-and-triggering\/#primaryimage\"},\"keywords\":\"first-articles,mqseries,MQSERIES TRIGGER\",\"articleSection\":\"Articles,MQSeries\",\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/navveenbalani.dev\/#\/schema\/person\/51f7ab14b20611d95e3c7fd4ea0950bf\",\"name\":\"Navveen\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/navveenbalani.dev\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/navveenbalani.dev\/wp-content\/uploads\/2019\/07\/navveen_balani.jpeg\",\"width\":200,\"height\":200,\"caption\":\"Navveen\"},\"logo\":{\"@id\":\"https:\/\/navveenbalani.dev\/#personlogo\"},\"sameAs\":[\"http:\/\/naveenbalani.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/posts\/1190"}],"collection":[{"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/comments?post=1190"}],"version-history":[{"count":13,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/posts\/1190\/revisions"}],"predecessor-version":[{"id":2145,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/posts\/1190\/revisions\/2145"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/media\/1197"}],"wp:attachment":[{"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/media?parent=1190"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/categories?post=1190"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/navveenbalani.dev\/index.php\/wp-json\/wp\/v2\/tags?post=1190"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}