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
A strange thing is happening along the way to the Internet of Things, namely far too many devices to work with and manage. It has become clear that we'll need much higher efficiency user experiences that can allow us to more easily and scalably work with the thousands of devices that will soon be in each of our lives. Enter the conversational interface revolution, combining bots we can literally talk with, gesture to, and even direct with our thoughts, with embedded artificial intelligence, whic...
Coca-Cola’s Google powered digital signage system lays the groundwork for a more valuable connection between Coke and its customers. Digital signs pair software with high-resolution displays so that a message can be changed instantly based on what the operator wants to communicate or sell. In their Day 3 Keynote at 21st Cloud Expo, Greg Chambers, Global Group Director, Digital Innovation, Coca-Cola, and Vidya Nagarajan, a Senior Product Manager at Google, discussed how from store operations and ...
In his session at 21st Cloud Expo, Carl J. Levine, Senior Technical Evangelist for NS1, will objectively discuss how DNS is used to solve Digital Transformation challenges in large SaaS applications, CDNs, AdTech platforms, and other demanding use cases. Carl J. Levine is the Senior Technical Evangelist for NS1. A veteran of the Internet Infrastructure space, he has over a decade of experience with startups, networking protocols and Internet infrastructure, combined with the unique ability to it...
It is of utmost importance for the future success of WebRTC to ensure that interoperability is operational between web browsers and any WebRTC-compliant client. To be guaranteed as operational and effective, interoperability must be tested extensively by establishing WebRTC data and media connections between different web browsers running on different devices and operating systems. In his session at WebRTC Summit at @ThingsExpo, Dr. Alex Gouaillard, CEO and Founder of CoSMo Software, presented ...
Gemini is Yahoo’s native and search advertising platform. To ensure the quality of a complex distributed system that spans multiple products and components and across various desktop websites and mobile app and web experiences – both Yahoo owned and operated and third-party syndication (supply), with complex interaction with more than a billion users and numerous advertisers globally (demand) – it becomes imperative to automate a set of end-to-end tests 24x7 to detect bugs and regression. In th...
"Space Monkey by Vivent Smart Home is a product that is a distributed cloud-based edge storage network. Vivent Smart Home, our parent company, is a smart home provider that places a lot of hard drives across homes in North America," explained JT Olds, Director of Engineering, and Brandon Crowfeather, Product Manager, at Vivint Smart Home, in this SYS-CON.tv interview at @ThingsExpo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
"Cloud Academy is an enterprise training platform for the cloud, specifically public clouds. We offer guided learning experiences on AWS, Azure, Google Cloud and all the surrounding methodologies and technologies that you need to know and your teams need to know in order to leverage the full benefits of the cloud," explained Alex Brower, VP of Marketing at Cloud Academy, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clar...
"MobiDev is a software development company and we do complex, custom software development for everybody from entrepreneurs to large enterprises," explained Alan Winters, U.S. Head of Business Development at MobiDev, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
SYS-CON Events announced today that CrowdReviews.com has been named “Media Sponsor” of SYS-CON's 22nd International Cloud Expo, which will take place on June 5–7, 2018, at the Javits Center in New York City, NY. CrowdReviews.com is a transparent online platform for determining which products and services are the best based on the opinion of the crowd. The crowd consists of Internet users that have experienced products and services first-hand and have an interest in letting other potential buye...
"There's plenty of bandwidth out there but it's never in the right place. So what Cedexis does is uses data to work out the best pathways to get data from the origin to the person who wants to get it," explained Simon Jones, Evangelist and Head of Marketing at Cedexis, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
"IBM is really all in on blockchain. We take a look at sort of the history of blockchain ledger technologies. It started out with bitcoin, Ethereum, and IBM evaluated these particular blockchain technologies and found they were anonymous and permissionless and that many companies were looking for permissioned blockchain," stated René Bostic, Technical VP of the IBM Cloud Unit in North America, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Conventi...
WebRTC is great technology to build your own communication tools. It will be even more exciting experience it with advanced devices, such as a 360 Camera, 360 microphone, and a depth sensor camera. In his session at @ThingsExpo, Masashi Ganeko, a manager at INFOCOM Corporation, introduced two experimental projects from his team and what they learned from them. "Shotoku Tamago" uses the robot audition software HARK to track speakers in 360 video of a remote party. "Virtual Teleport" uses a multip...
SYS-CON Events announced today that Telecom Reseller has been named “Media Sponsor” of SYS-CON's 22nd International Cloud Expo, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. Telecom Reseller reports on Unified Communications, UCaaS, BPaaS for enterprise and SMBs. They report extensively on both customer premises based solutions such as IP-PBX as well as cloud based and hosted platforms.
SYS-CON Events announced today that Evatronix 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. Evatronix SA offers comprehensive solutions in the design and implementation of electronic systems, in CAD / CAM deployment, and also is a designer and manufacturer of advanced 3D scanners for professional applications.
Leading companies, from the Global Fortune 500 to the smallest companies, are adopting hybrid cloud as the path to business advantage. Hybrid cloud depends on cloud services and on-premises infrastructure working in unison. Successful implementations require new levels of data mobility, enabled by an automated and seamless flow across on-premises and cloud resources. In his general session at 21st Cloud Expo, Greg Tevis, an IBM Storage Software Technical Strategist and Customer Solution Architec...
To get the most out of their data, successful companies are not focusing on queries and data lakes, they are actively integrating analytics into their operations with a data-first application development approach. Real-time adjustments to improve revenues, reduce costs, or mitigate risk rely on applications that minimize latency on a variety of data sources. In his session at @BigDataExpo, Jack Norris, Senior Vice President, Data and Applications at MapR Technologies, reviewed best practices to ...
An increasing number of companies are creating products that combine data with analytical capabilities. Running interactive queries on Big Data requires complex architectures to store and query data effectively, typically involving data streams, an choosing efficient file format/database and multiple independent systems that are tied together through custom-engineered pipelines. In his session at @BigDataExpo at @ThingsExpo, Tomer Levi, a senior software engineer at Intel’s Advanced Analytics gr...
When talking IoT we often focus on the devices, the sensors, the hardware itself. The new smart appliances, the new smart or self-driving cars (which are amalgamations of many ‘things’). When we are looking at the world of IoT, we should take a step back, look at the big picture. What value are these devices providing? IoT is not about the devices, it’s about the data consumed and generated. The devices are tools, mechanisms, conduits. In his session at Internet of Things at Cloud Expo | DXWor...
Everything run by electricity will eventually be connected to the Internet. Get ahead of the Internet of Things revolution. In his session at @ThingsExpo, Akvelon expert and IoT industry leader Sergey Grebnov provided an educational dive into the world of managing your home, workplace and all the devices they contain with the power of machine-based AI and intelligent Bot services for a completely streamlined experience.
SYS-CON Events announced today that Synametrics Technologies will exhibit at SYS-CON's 22nd International Cloud Expo®, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. Synametrics Technologies is a privately held company based in Plainsboro, New Jersey that has been providing solutions for the developer community since 1997. Based on the success of its initial product offerings such as WinSQL, Xeams, SynaMan and Syncrify, Synametrics continues to create and hone inn...