Setting up MSMQ on your Mobile and Writing MSMQ Application with .NET Compact Framework 3.5

0
213
3 min read

Let’s get started.

Setting up Microsoft Messaging Queue Service (MSMQ) on your mobile device

MSMQ is not installed by default on the Windows Mobile platform. This section will guide you on how to install MSMQ on your mobile device or device emulator. You will first need to download the Redistributable Server Components for Windows Mobile 5.0 package (which can also be used for Windows Mobile 6.0) from this location:

href=”http://www.microsoft.com/downloads/details.aspx?FamilyID=cdfd2bb2-fa13-4062-b8d1-4406ccddb5fd&displaylang=en

After downloading and unzipping this file, you will have access to the MSMQ.arm.cab file in the following folder: Optional Windows Mobile 5.0 Server Componentsmsmq

Copy this file via ActiveSync to your mobile device and run it on the device. This package contains two applications (and a bunch of other DLL components) that you will be using frequently on the device:

  • msmqadm.exe:This is the command line tool that allows you to start and stop the MSMQ service on the mobile device and also configure MSMQ settings. It can also be invoked programmatically from code.
  • visadm.exe: This tool does the same thing as above, but provides a visual interface.

These two files will be unpacked into the Windows folder of your mobile device. The following DLL files will also be unpacked into the Windows folder:

  • msmqd.dll
  • msmqrt.dll

Verify that these files exist. The next thing you need to do is to change the name of your device (if you haven’t done so earlier). In most cases, you are probably using the Windows Mobile Emulator, which comes with an unassigned device name by default. To change your device name, navigate to Settings | System | About on your mobile device. You can change the device name in the Device ID tab. At this point, you have the files for MSMQ unpacked, but it isn’t exactly installed yet. To do this, you must invoke either msmqadm.exe or visadm.exe. Launch the following application:

Windowsvisadm.exe

A pop-up window will appear. This window contains a text box and a Run button that allows you to type in the desired command and to execute it. The first command you need to issue is the register install command. Type in the command and click the Run button. No message will be displayed in the window. This command will install MSMQ (as a device driver) on your device.

Run the following commands in the given order next (one after the other):

MSMQ Command Name

Purpose

register

You will need to run the register command one more time (without the install keyword) to create the MSMQ configuration keys in the registry.

enable binary

This command enables the proprietary MSMQ binary protocol to send messages to remote queues.

enable srmp

This command enables SRMP (SOAP Reliable Messaging Protocol), for sending messages to remote queues over HTTP.

start

This command starts the MSMQ service

 

Verify that the MSMQ service has been installed successfully by clicking on the Shortcuts button and then clicking the Verify button in the ensuing pop-up window. You will be presented with a pop-up dialog as shown in the following screenshot:

MSMQ log information

If you scroll down in this same window above, you will find the Base Dir path, which contains the MSMQ auto-generated log file. This log file, named MQLOGFILE by default, contains useful MSMQ related information and error messages.

After you’ve done the preceding steps, you will need to do a soft-reset of your device. The MSMQ service will automatically start upon boot up.


Subscribe to the weekly Packt Hub newsletter

* indicates required

LEAVE A REPLY

Please enter your comment!
Please enter your name here