Sample applications
To run your own .NET applications, use the instructions for the verification programs, substituting your application name in place of the sample applications.
- A put message application
- A get message application
- A 'hello world' application
- A publish/subscribe application
- An application using message properties
All these sample applications are supplied in the C# language, and some are also supplied in C++ and Visual Basic. You can write applications in any language supported by .NET.
- "Put message" program SPUT (nmqsput.cs, mmqsput.cpp, vmqsput.vb)
- This program shows how to put a message to a named queue. The program has three parameters:
- The name of a queue (required), for example, SYSTEM.DEFAULT.LOCAL.QUEUE
- The name of a queue manager (optional)
- The definition of a channel (optional), for example, SYSTEM.DEF.SVRCONN/TCP/hostname(1414)
- "Get message" program SGET (nmqsget.cs, mmqsget.cpp, vmqsget.vb)
- This program shows how to get a message from a named queue. The program has three parameters:
- The name of a queue (required), for example, SYSTEM.DEFAULT.LOCAL.QUEUE
- The name of a queue manager (optional)
- The definition of a channel (optional), for example, SYSTEM.DEF.SVRCONN/TCP/hostname(1414)
- "Hello World" program (nmqwrld.cs, mmqwrld.cpp, vmqwrld.vb)
- This program shows how to put and get a message. The program has three parameters:
- The name of a queue (optional), for example, SYSTEM.DEFAULT.LOCAL.QUEUE or SYSTEM.DEFAULT.MODEL.QUEUE
- The name of a queue manager (optional)
- A channel definition (optional), for example, SYSTEM.DEF.SVRCONN/TCP/hostname(1414)
- "Publish/subscribe" program (MQPubSubSample.cs)
- This program shows how to use IBM® MQ publish/subscribe. It is supplied in C# only. The program has two parameters:
- The name of a queue manager (optional)
- A channel definition (optional)
- "Message properties" program (MQMessagePropertiesSample.cs)
- This program shows how to use message properties. It is supplied in C# only. The program has two parameters:
- The name of a queue manager (optional)
- A channel definition (optional)
You can verify your installation by compiling and running these applications.
MQ_INSTALLATION_PATH
represents the high-level directory in which IBM MQ is installed.- C#
-
MQ_INSTALLATION_PATH
\Tools\dotnet\samples\cs\nmqswrld.csMQ_INSTALLATION_PATH
\Tools\dotnet\samples\cs\nmqsput.csMQ_INSTALLATION_PATH
\Tools\dotnet\samples\cs\nmqsget.csMQ_INSTALLATION_PATH
\Tools\dotnet\samples\cs\MQPubSubSample.csMQ_INSTALLATION_PATH
\Tools\dotnet\samples\cs\MQMessagePropertiesSample.cs - Managed C++
-
MQ_INSTALLATION_PATH
\Tools\dotnet\samples\mcp\mmqswrld.cppMQ_INSTALLATION_PATH
\Tools\dotnet\samples\mcp\mmqsput.cppMQ_INSTALLATION_PATH
\Tools\dotnet\samples\mcp\mmqsget.cpp - Visual Basic
-
MQ_INSTALLATION_PATH
\Tools\dotnet\samples\vb\vmqswrld.vbMQ_INSTALLATION_PATH
\Tools\dotnet\samples\vb\vmqsput.vbMQ_INSTALLATION_PATH
\Tools\dotnet\samples\vb\vmqsget.vbMQ_INSTALLATION_PATH
\Tools\dotnet\samples\vb\xmqswrld.vbMQ_INSTALLATION_PATH
\Tools\dotnet\samples\vb\xmqsput.vbMQ_INSTALLATION_PATH
\Tools\dotnet\samples\vb\xmqsget.vb
- C#
-
MQ_INSTALLATION_PATH
\Tools\dotnet\samples\cs\bldcssamp.batThe bldcssamp.bat file contains a line for each sample, which is all that is necessary to build this sample program:csc /t:exe /r:System.dll /r:amqmdnet.dll /lib:
MQ_INSTALLATION_PATH
\bin /out:nmqwrld.exe nmqwrld.cs - Managed C++
-
MQ_INSTALLATION_PATH
\Tools\dotnet\samples\mcp\bldmcpsamp.batThe bldmcpsamp.bat file contains a line for each sample, which is all that is necessary to build this sample program:cl /clr:oldsyntax
MQ_INSTALLATION_PATH
\bin mmqwrld.cppIf you want to compile these applications on Microsoft Visual Studio 2003/.NET SDKv1.1, replace the compile command:
withcl /clr:oldsyntax
MQ_INSTALLATION_PATH
\bin mmqwrld.cppcl /clr
MQ_INSTALLATION_PATH
\bin mmqwrld.cpp - Visual Basic
-
MQ_INSTALLATION_PATH
\Tools\dotnet\samples\vb\bldvbsamp.batThe bldvbsamp.bat file contains a line for each sample, which is all that is necessary to build this sample program:vbc /r:System.dll /r:
MQ_INSTALLATION_PATH
\bin\amqmdnet.dll /out:vmqwrld.exe vmqwrld.vb