Welcome!

Weblogic Authors: Yeshim Deniz, Elizabeth White, Michael Meiner, Michael Bushong, Avi Rosenthal

Related Topics: Weblogic

Weblogic: Article

Sending Messages to the Other Side

Sending Messages to the Other Side

This month, I thought I would take a below-the-surface look at what needs to be done to achieve transactional access to the IBM MQSeries messaging product from WebLogic Server within the context of an Xa transaction managed by WebLogic's JTA subsystem. Of course, from the outset I would like to note that WebLogic Server itself boasts a very capable and reliable messaging system - which is getting more capable with every release - but it is a fact of life that MQseries for various reasons (most predating the existence of Java, never mind the JMS messaging standard) has a large installed base, so good interoperability with it is a requirement whatever your infrastructure religion.

So Tell Me the Good News
Well, Okay, I will. The first piece of good news if you are looking for programmatic integration between WebLogic Server and MQ is that there is working code to achieve just that available on BEA's dev2dev Web site at http://dev2dev.bea.com/code/codedetailcontent.jsp? productType=weblogic+server&codeType=alpha+code&filepath= components%2Fdev2dev%2Fcodelibrary%2Falphacode%2 Falphacodewlsmqseries.htm. However, there are some features of its implementation that bear closer scrutiny to get further insight into what needs to be done to interface these two environments. If you're not into intricate details, I recommend that you proceed directly to the conclusion now for an early bath - I am about to start indulging my love of the obscure...

You're still here? Good, another implementation trivia lover - I can see that we're going to get on famously. Take a deep breath; I'm sure you're going to enjoy the trip!

Enjoy the Trip!
On the face of it, part of the MQSeries product is a Java wrapper that implements the JMS programming interface and supports the XA extensions. To aid code portability, JMS provides for connection factories, queues, and topic objects to be defined prior to application runtime and stored using a JNDI provider, so using all these standards from within the WebLogic Server environment should be simplicity itself, right?

Well, almost. There are some wrinkles that come from MQSeries restrictions that derive from the implementation of MQ itself. These need to be coded around if WebLogic Server and MQ are to live together in perfect harmony. Most of the code posted on dev2dev is concerned with ironing out these wrinkles so that the two products can coexist in perfect harmony, or at least without shed loads of cacophonous discord, or as MC geek and the OLTP crew might say "so the MQ thing doesn't go in the crapper, BEA Systems have written a wrapper."

So What Is This Wrapper Up To?
Rather than a full top-down review of the whole thing, I will spend the rest of the article reviewing the purpose of a subset of it. This will hopefully provide a level of understanding both of the XA implementation of MQ, and of the WebLogic Server transaction manager.

The first part of the wrapper is a class that maps the MQ JNDI entires from an external JNDI directory into the WebLogic JNDI tree. On the way, it interposes its wrapped versions of the XQQueueConnectionFactory or XATopicConnectionFactory. The net result is that the set of connection/topic factories present in MQSeries becomes visible in the WebLogic Server environment, with a wrapper to do the rest of the integration magic.

The wrapper at the base of the remaining mystery is a wrapper for the MQSeries XA resources. As XA resources are dispensed from the MQ factories, they in turn are wrapped, and it is in this resource wrapper that the business end of things happens.

First, the constructor of the resource wrapper registers each XA resource - once per server - under a resource name that is either given or constructed from the server and domain names and the MQ resource string. The wrapper also allows the MQSeries integration to take advantage of an optimization in the WebLogic transaction manager, namely dynamic enlistment.

So, I hear you cry, what's that? The JTA specification allows only for static enlistment, which means that all resources must register their existence at startup, and from this point on the application server must assume that all resources registered with it participated in every transaction and enlist them in JTA transactions on that basis so they are sent a commit for each transaction on the off chance that they participated. With dynamic registration, resources can enlist with JTA lazily as they are invoked in a transaction - meaning that the transaction manager knows the correct set to coordinate at commit time, improving performance. The resource name associated with a resource is used by WebLogic as a branch qualifier for the transaction. It is also used in recovery so that outstanding transactions can be completed from transaction log records. This means that these resource names must be assumed to be constant across multiple server reboots to allow for transaction recovery.

Finally, an XA resource provides a method called isSameRM that allows a transaction manager to determine conclusively if two participants in a transaction are really one and the same resource. The wrapper provides its own implementation of this method with different behavior from the out-of-the-box implementation from IBM. The reasons for this are slightly obscure, but here goes... IBM's implementation of isSameRM bases the decision on the QueueManager. The wrapper is designed to base the isSameRM decision on the name associated with the XAConnectionFactory (remember the significance of the resource name in terms of the transaction branch?). This allows multiple branches to be used for a particular MQSeries QM. This is important when multiple MQ sessions are to be manipulated in a transaction. Due to the behaviors of the WL TM and the IBM JMS implementation, the direct use of multiple MQ sessions in a single transaction can result in XA errors. The IBM JMS requires that each XAResource instance, that is associated with a particular Session, be enlisted and delisted from the transaction. The WebLogic Transaction Manager implements a delayed delistment optimization, which delays calling XA.end (the XA call that performs the delistment) until absolutely necessary (transaction suspended, commit called, etc.). This optimization helps avoid multiple start/end calls when the same resource is accessed multiple times within a transaction. However, because each JMS session has a unique XAResource object, and their isSameRM methods will return true for each other, WebLogic's Transaction Manager will treat them as if they were the same. The first session accessed will receive an XA.start call.to enlist it in the current transaction. When the JMS operation returns, the optimization will delay the XA.end call to delist the resource. When an operation is invoked on the second session, XA.start will not be called because the Transaction Manager thinks that it is the same resource and it knows it has already called XA.start on it. Following that, when the JMS call is made the IBM driver will respond with a 2072 "Syncpoint not available" error because MQSeries didn't get the XA.start it was expecting - since as far as it is concerned this is a different resource - so it decides that the call is being made outside of a global transaction.

Come Up for Some Air, Here's The Really Good News
Phew, you can come up for air now.... This transaction stuff sure provides some late night entertainment. Or perhaps a cure for insomnia. It depends on your viewpoint I suppose.

The good news is that WebLogic Server versions greater than 6.1sp3 provide an out-of-the-box transactional MQ Series bridge that allows you to map WebLogic JMS queues and topics to MQ ones without writing a single line of code - just configure the source and destination queues to be bridged and away it goes. Even better news is that the next release preview bird has told me that a transparent JMS wrapper is in the works. This will allow you to configure foreign queues into the WebLogic environment where the server will transparently take care of all this wrapping.

Yet another reason why both above and below the J2EE standards surface WebLogic Server will remain ahead of the pack in terms of ease of use - bringing faster time to market to all who use it as a platform for their applications.

That's it from me for now - I'll delist until next month. Happy transacting.

More Stories By Peter Holditch

Peter Holditch is a senior presales engineer in the UK for Azul Systems. Prior to joining Azul he spent nine years at BEA systems, going from being one of their first Professional Services consultants in Europe and finishing up as a principal presales engineer. He has an R&D background (originally having worked on BEA's Tuxedo product) and his technical interests are in high-throughput transaction systems. "Of the pitch" Peter likes to brew beer, build furniture, and undertake other ludicrously ambitious projects - but (generally) not all at the same time!

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


@ThingsExpo Stories
SYS-CON Events announced today that Daiya Industry will exhibit at the Japanese Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Ruby Development Inc. builds new services in short period of time and provides a continuous support of those services based on Ruby on Rails. For more information, please visit https://github.com/RubyDevInc.
As businesses evolve, they need technology that is simple to help them succeed today and flexible enough to help them build for tomorrow. Chrome is fit for the workplace of the future — providing a secure, consistent user experience across a range of devices that can be used anywhere. In her session at 21st Cloud Expo, Vidya Nagarajan, a Senior Product Manager at Google, will take a look at various options as to how ChromeOS can be leveraged to interact with people on the devices, and formats th...
SYS-CON Events announced today that Yuasa System will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Yuasa System is introducing a multi-purpose endurance testing system for flexible displays, OLED devices, flexible substrates, flat cables, and films in smartphones, wearables, automobiles, and healthcare.
SYS-CON Events announced today that Taica will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Taica manufacturers Alpha-GEL brand silicone components and materials, which maintain outstanding performance over a wide temperature range -40C to +200C. For more information, visit http://www.taica.co.jp/english/.
As hybrid cloud becomes the de-facto standard mode of operation for most enterprises, new challenges arise on how to efficiently and economically share data across environments. In his session at 21st Cloud Expo, Dr. Allon Cohen, VP of Product at Elastifile, will explore new techniques and best practices that help enterprise IT benefit from the advantages of hybrid cloud environments by enabling data availability for both legacy enterprise and cloud-native mission critical applications. By rev...
Organizations do not need a Big Data strategy; they need a business strategy that incorporates Big Data. Most organizations lack a road map for using Big Data to optimize key business processes, deliver a differentiated customer experience, or uncover new business opportunities. They do not understand what’s possible with respect to integrating Big Data into the business model.
Recently, REAN Cloud built a digital concierge for a North Carolina hospital that had observed that most patient call button questions were repetitive. In addition, the paper-based process used to measure patient health metrics was laborious, not in real-time and sometimes error-prone. In their session at 21st Cloud Expo, Sean Finnerty, Executive Director, Practice Lead, Health Care & Life Science at REAN Cloud, and Dr. S.P.T. Krishnan, Principal Architect at REAN Cloud, will discuss how they b...
Enterprises have taken advantage of IoT to achieve important revenue and cost advantages. What is less apparent is how incumbent enterprises operating at scale have, following success with IoT, built analytic, operations management and software development capabilities – ranging from autonomous vehicles to manageable robotics installations. They have embraced these capabilities as if they were Silicon Valley startups. As a result, many firms employ new business models that place enormous impor...
SYS-CON Events announced today that Dasher Technologies will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Dasher Technologies, Inc. ® is a premier IT solution provider that delivers expert technical resources along with trusted account executives to architect and deliver complete IT solutions and services to help our clients execute their goals, plans and objectives. Since 1999, we'v...
SYS-CON Events announced today that MIRAI Inc. will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. MIRAI Inc. are IT consultants from the public sector whose mission is to solve social issues by technology and innovation and to create a meaningful future for people.
SYS-CON Events announced today that TidalScale, a leading provider of systems and services, will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. TidalScale has been involved in shaping the computing landscape. They've designed, developed and deployed some of the most important and successful systems and services in the history of the computing industry - internet, Ethernet, operating s...
SYS-CON Events announced today that TidalScale will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. TidalScale is the leading provider of Software-Defined Servers that bring flexibility to modern data centers by right-sizing servers on the fly to fit any data set or workload. TidalScale’s award-winning inverse hypervisor technology combines multiple commodity servers (including their ass...
Amazon is pursuing new markets and disrupting industries at an incredible pace. Almost every industry seems to be in its crosshairs. Companies and industries that once thought they were safe are now worried about being “Amazoned.”. The new watch word should be “Be afraid. Be very afraid.” In his session 21st Cloud Expo, Chris Kocher, a co-founder of Grey Heron, will address questions such as: What new areas is Amazon disrupting? How are they doing this? Where are they likely to go? What are th...
SYS-CON Events announced today that IBM has been named “Diamond Sponsor” of SYS-CON's 21st Cloud Expo, which will take place on October 31 through November 2nd 2017 at the Santa Clara Convention Center in Santa Clara, California.
Infoblox delivers Actionable Network Intelligence to enterprise, government, and service provider customers around the world. They are the industry leader in DNS, DHCP, and IP address management, the category known as DDI. We empower thousands of organizations to control and secure their networks from the core-enabling them to increase efficiency and visibility, improve customer service, and meet compliance requirements.
Join IBM November 1 at 21st Cloud Expo at the Santa Clara Convention Center in Santa Clara, CA, and learn how IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Cognitive analysis impacts today’s systems with unparalleled ability that were previously available only to manned, back-end operations. Thanks to cloud processing, IBM Watson can bring cognitive services and AI to intelligent, unmanned systems. Imagine a robot vacuum that becomes your personal assistant tha...
In his Opening Keynote at 21st Cloud Expo, John Considine, General Manager of IBM Cloud Infrastructure, will lead you through the exciting evolution of the cloud. He'll look at this major disruption from the perspective of technology, business models, and what this means for enterprises of all sizes. John Considine is General Manager of Cloud Infrastructure Services at IBM. In that role he is responsible for leading IBM’s public cloud infrastructure including strategy, development, and offering ...
SYS-CON Events announced today that IBM has been named “Diamond Sponsor” of SYS-CON's 21st Cloud Expo, which will take place on October 31 through November 2nd 2017 at the Santa Clara Convention Center in Santa Clara, California.
SYS-CON Events announced today that N3N will exhibit at SYS-CON's @ThingsExpo, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. N3N’s solutions increase the effectiveness of operations and control centers, increase the value of IoT investments, and facilitate real-time operational decision making. N3N enables operations teams with a four dimensional digital “big board” that consolidates real-time live video feeds alongside IoT sensor data a...
In a recent survey, Sumo Logic surveyed 1,500 customers who employ cloud services such as Amazon Web Services (AWS), Microsoft Azure, and Google Cloud Platform (GCP). According to the survey, a quarter of the respondents have already deployed Docker containers and nearly as many (23 percent) are employing the AWS Lambda serverless computing framework. It’s clear: serverless is here to stay. The adoption does come with some needed changes, within both application development and operations. Tha...