Resources for IBM WebSphere MQ and .NET implementation - c#

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).

Related

Solace JNDI/JMS Syntax for C# .NET

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.

Raw MQ messages with WCF

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.

How do I connect to the IBM WebSphere MQ without having the IBM WebSphere MQ Client installed on the client machine?

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

Using Websphere MQ with JMS from a .NET application

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

Is there any free library that implements message queuing similar to MSMQ (Microsoft Message Queuing)?

I am interested in using a free library that has features similar to MSMQ to send/receive messages among 3 app domains in a win form application.
I only need the private queue functionality (No public queues or AD support)
Please provide links and some advantages/disadvantages . I am happy to open sub questions if you think you need more points for finer details.
Note: Unfortunately I have some users that do not have Windows XP professional edition (MSMQ is not available)
I saw Apache ActiveMQ and rabbit MQ but it seems a bit overkill for what I need to do.
http://activemq.apache.org/
http://www.rabbitmq.com/
It is possible to implement this feature using a singleton Queue protected by a named mutex, but I would not like to spend the time if somebody has already done it.
There is Rhino Queues. The author is considered to be a pretty good developer.
How about NServiceBus using the shared memory transport? The creator, Udi Dahan, is a well respected individual in the message based architecture space.
If it's all in the same application then sharing a synchronized queue is what you want, have a look at the Queue.Synchronized method in MSDN, that provides you with a thread-safe queue.
At some point, there is going to have to be some client specific code to accept messages. If the users need to accept messages on their machines, it sounds like a smart client situation. In the Windows world, there is a smart client which does messaging, and allows users to work with data in a disconnected way.
I can't imagine any one library which will allow messaging on different operating systems. Even if a singleton is used, there has to be some cross-platform way to send/receive the messages. It seems like the client end would always have to be OS specific.
It might be possible to try Mono on the non-windows side. There is a tool you can use to see if a third party library has dependencies which will not run in Mono. It was released with the Mono tools for Visual Studio. It is called the Mono Migration Analyzer (MoMA).
See also this system:
http://www.codeproject.com/Articles/193611/DotNetMQ-A-Complete-Message-Queue-System-for-NET
DotNetMQ is an open source Message Broker that has several features:
Persistent or non-persistent messaging.
Guaranteed delivery of persistent messages even in a system crash.
Automatic and manual routing of messages in a custom machine graph.
Supports multiple databases (MS SQL Server, MySQL, SQLite, and memory-based storage for now).
Supports don’t store, direct send style messaging.
Supports Request/Reply style messaging.
Easy to use client library to communicate with the DotNetMQ Message Broker.
Built-in framework to easily construct RMI services upon message queues.
Supports delivering messages to ASP.NET Web Services.
GUI-based management and monitoring tool.
Easy to install, manage, and use.
You might want to look at Retlang http://code.google.com/p/retlang/

Categories