The XMS samples are based on the the existing samples shipped with IBM MQ Server and Client packages. The samples here have been tested with .NET Framework 4.6 and Visual Studio Community 2017 v 15.9.5. Updates have been tested with Visual Studio Community 2019 v 16.1.4 and .NET Framework 4.8.03761.
Windows MQ client v 9.1.2.0 download
We have included '.sln', '.csproj', 'packages.config' and 'AssemblyInfo.cs' files. These were created with the Visual Studio Community 2019. We've also added the copy of the 'env.json' file from the top level directory to the '/dotnet' project directory, you'll need to copy this again to '/bin/Debug' in your project directory and adjust the parameters to use your own queue manager.
IBM Message Service Client for .NET Standard (XMS .NET)
Reference it through Solution Explorer NuGet Package installer
We drive the running of all the samples through this one module that has the one main entry point in the project. Once you've built the project in Visual Studio, you can run the project .exe on the command line from the project directory bin/debug location or bin/release depending on how you built it.
For example:
ibmmq_samples.exe put
Run
ibmmq_samples.exe put
In a separate terminal
ibmmq_samples.exe get
In the first terminal;
You have to run the subscriber sample first so it creates a subscription and waits for a publication.
Run
ibmmq_samples.exe sub
In the second terminal;
Run the publisher sample
ibmmq_samples.exe pub
In the first terminal;
Run the request sample
Run
ibmmq_samples.exe request
The request sample will put a message and wait for a response until it either gets a response or you ctrl+c interrupt it.
In the second terminal;
Run the response sample
Run
ibmmq_samples.exe response
The response sample will get a message from the queue, process it and put the response on the reply to queue and keep looking for more messages to respond to till you ctrl+c interrupt it.
If you are using a .NET managed client, then the underlying .NET framework will carry out the TLS handshake with the MQ Server. Any exceptions generated in the .NET layer during the TLS handshake will surface as server or queue not found - 2059.
To overcome this you need to import the client .p12 (or client side .kdb) certificate into Windows. Import it at either the user or the system level. Then in your app, set the key repository to either *USER or *SYSTEM depending on how you imported it.
For 'unmanaged' mode set KEY_REPOSITORY in your JSON file to the location of your key database / truststore
"KEY_REPOSITORY": "./keys/clientkey",
For 'managed' mode set KEY_REPOSITORY in your JSON file to
"KEY_REPOSITORY": "*USER",
or
"KEY_REPOSITORY": "*SYSTEM",
To find out how to import certificates on Windows, see How to: View certificates with the MMC snap-in and Import and Export Certificate - Microsoft Windows.