I'm trying to send a message to a java server over a Websphere MQ which uses JMS as the transport protocol. I can happily drop messages on the MQ using the IBM supplied libraries, but the server rejects them. I'm assuming (hopefully correctly) that this is because I'm missing various JMS specific headers/properties on the MQ message.
I have ensured the payloads for the messages are the same by inspecting the queue (they are both map messages if that helps), but don't want to fully implement the JMS Websphere MQ protocol just to get this to work.
I'm wondering if anyone has managed to get this to work, and if so what's the minimum amount of information you need to specify in the JMS header? Are there any alternatives to doing this directly on the MQ (I've seen some about using java interop, but this is something I think would be overkill).
Any help would be greatly appreciated!
Can you paste the Java code you are using to read the message. Is that code assuming that the message is a "MapMessage". Normally something put into a Queue from a non-java client will appear as either a TextMessage or a BytesMessage.
The WebsphereMQ JMS api is normally fine with reading those messages without the JMS headers as long as you read as a TextMessage / BytesMessage as put.
In my server code, my content is normally put to the queue as bytes, and so appears as a BytesMessage, but just in case i get a message that was manually put on the queue, i catch the classcastexception, and test to see if it is in fact a TextMessage.
Are you trying to use MQI to send JMS messages? Take a look at the XMS libraries from IBM. They will provide everything that you need. The libraries provide a .NET implementation of JMS that works with WebsphereMQ. I have used these libs many times over the past year, talking between java and .net systems, and have been very happy with the functionality.
XMS .NET Library Download
WebSphere MQ doesn't have very clear error messages. The things I suggest to check when something went wrong are:
Exception details and their recursive causes.
MQ error logs.
Event logs sourced by MQ.
.FDC files.
I think I had the same problem and I couldn't get XMS to work. In case it's still a problem to you, this might help
Regards Kristoffer
Related
A vendor is using Solace to send messages. I have obtained a SubscriptionId using web service call, that I supposed to be submitted to the Solace server.
Using the documentation and sample code at dev.solace.com, I have been able to connect a session. However, I am lost as to how to go to the next step which is to subscribe to what I believe is a queue using a connection factory, jndi factory an jms destination name.
The sample shows this:
Session.Connect(ContextFactory.Instance.CreateQueue(Topic), true);
But from what I can tell, that won't work as the vendor wants jndi/jms, and the Solace documentation has no .NET code for jndi/jms, which leaves me guessing.
Help!
Please use the JMS API instead of the .NET API in order to perform JMS.
The .NET API does not do JMS.
Note that you can send/receive messages using the .NET API that's inter-operable with the JMS API.
However, since you have a hard requirement to use JMS, your only option is to use the JMS API.
As It turns out, the jndi/jms information delivered by the host for configuration was unneeded. What was necessary was to connect to the queue and receive the messages.
Is there a way, using MQ 7.5, to get MQ WCF to place "raw" messages into an MQ queue? It seems to be limited to SOAP-JMS formats.
By raw, I mean non-SOAP, non-JMS, non-XML, just a simple message.
MQ 8 provides this feature with WmqStringMessage as per here, but I'm wondering about a good way to get just a standard MQSTR-type message into an MQ queue.
Short of IBM back-porting changes from later versions of MQ to MQ7, there is no easy way to achieve this.
In the end, we ditched the use of WCF since most of the features we used are also implemented in MQ itself, such as durable transactions and guaranteed delivery.
WCF is good if you want to be able to chop and change the underlying delivery mechanisms but, if all you're using is MQ, it's easier to just code directly to that API.
I was looking for something to enable me to do this but couldn't find much.
I followed the steps described in the following answer to another question -
https://stackoverflow.com/a/23920904/3299246
but that isn't working. I get a lot of errors saying the files/dependencies were not found.
Is there any way I can connect to the MQ without having the client installed?
Thanks.
Adding a new answer in light of the revelation that this is for mobile. You don't say whether this is for Windows Phone or Surface. I am not familiar enough with Surface, but IBM might even have a version of the MQ client that will work on it. Or maybe not.
Whether you are using Windows Phone for mobile or a Surface device, the device should not have a problem connecting to a WCF Service which connects to WMQ. James the Integration Guy has done a bit of work with this, and here's a blog post that might contain some ideas for you:
Using .NET WCF to connect to WebSphere MQ
Unfortunately, the blog appears to be inactive, so there may be no update on his progress.
ETA: Just to expand on my comment, Android can be made to connect to a WCF Service. Some links:
Lessons Learned: Getting Android to Connect to a WCF Service
How to connect to a wcf Service with Android - Stack Overflow
Connect to WCF service through android - Android Forums
Afraid not officially... At the moment, my understanding is to run MQ .NET applications you need to have the MQ Client (or Server) installed which provides the .NET capability (either through the file system or via the GAC). You can run in fully managed mode, avoiding the need for calling through the C runtime components for the client functionality.
With some releases of MQ you are able to extract out just the files you need (its not just one file!) and be able to run in fully managed mode, but I would not recommend it... Feel free to raise a requirement with IBM
You could take your life in your own hands and try using IKVM to convert the pure Java WebSphere MQ libraries to .Net IL. I have never tried it with WebSphere MQ Java libraries specifically, but I have had a 96% success rate with many other Java libs.
Even if this works.... it will be unsupported.
The first answer that comes to my mind is actually a question: Why on earth would you want to try to do this?
The WMQ client is very unintrusive and there really isn't a good reason to do without it. It's free to use and so cost is not an issue. Have you discovered some niche environment for which IBM has failed to provide a version of the client? Unless this is the case I suggest you abandon this notion.
Most of the integration of mobile to WebSphere MQ that I'm aware of uses MQTT and the WebSphere MQ MQXR component. MQXR (for Extended Reach) is an MQTT broker running as a sub-process of the QMgr. It provides the full MQTT broker implementation and optionally bridges between MQTT and the QMgr.
Please see the MQ Knowledge Center for details:
Administering WebSphere MQ Telemetry
Are the WCF / .Net demos provided with IBM MQ still applicable if you use JMS with IBM MQ? Or do I need to write directly to JMS from .Net? (Very ignorant here if you couldn't tell). If I have to write to JMS directly then I guess i could use JNBridge or something.
Any info is greatly appreciated.
Yes, they still apply. You'll find that you have much better performance using a direct DLL for the server instead of a bridge, since the DLL directly implements the underlying messaging protocol for the server.
I need help with implementing IBM WebSphere MQ for a system where the queue is supposed to send the XML messages to a SQL database. May please help me with resources and video tutorials for the matter in hand. The system will be in C#
Thanks!
Message Service Client for .NET a.k.a XMS .NET is now part of WebSphere MQ v701. You can find latest documentation on XMS .NET here. XMS .NET gets installed along with MQ Client from v701 on-wards.
How are you wanting to access MQ? Are you using JMS or MQI?
There are a couple different ways to access MQ from .NET. The first way is through the native MQ interface known as MQI. The second way is through a JMS implementation created by IBM called XMS.
The queue is not going to write anything into a database for you. You are are going to need to create a listener application that does that.
EDIT:
If you want to use JMS then you should take a look at the doc link that Shashi posted below. here
You will want to look at the docs under "Message Service Client .NET, Version 2.0.0" --> "Developing XMS Applications" --> "Writing XMS .NET applications"
Also take a look at the sample applications that are packaged with the client.
Essentially what you are going to end up doing is creating a connection to the queue manager (either remote or local depending on your use case), creating a destination object that will represent the queue you are trying to work with on the queue manager, and then creating a listener to receive messages from the queue (either sync or async depending on your use case).