HTTP Transport (Windows CE 5.0)
MSMQ provides HTTP support for referencing queues, formatting messages, and HTTP message authentication. In opening queues, direct format names can include the URL to the queue.
The following format name references a queue that resides on a computer that is running Message Queuing.
DIRECT=HTTP://URLAddressSpecification/msmq/private$/myQueue
HTTP format names can use forward slashes (/) or back slashes (\) to separate Message Queuing information, but you can only use the back slash (\) after URLAddressSpecification/msmq.
For example, the following two format names can be used to reference myQueue.
DIRECT=HTTP://URLAddressSpecification/msmq/private$/myQueue
DIRECT=HTTP://URLAddressSpecification/msmq\private$\myQueue
MSMQ lets you specify HTTP as the delivery protocol for messages. Natural extensions to the programming model allow the application developer to indicate which underlying protocol will be used to deliver messages.
The following code example shows how to send an SRMP message over an HTTP connection.
...
MQMSGPROPS msgprops;
//prepare 'msgprops'
...
HANDLE hQueue; // Queue handle
HRESULT hr = MQOpenQueue(L"direct=http://cepc123.microsoft.com/msmq/private$/queue1", // Format name of queue
MQ_SEND_ACCESS, // Access mode
MQ_DENY_NONE, // Share mode
&hQueue // OUT: Handle to queue
);
if(FAILED(hr))
{
printf("MQOpenQueue() fail, error = 0x%X", hr);
return -1;
}
hr = MQSendMessage(hQueue, // Handle of open queue
&msgprops, // Properties of message
NULL); // No transaction
if(FAILED(hr))
{
printf("MQSendMessage() fail, error = 0x%X", hr);
}
hr = MQCloseQueue(hQueue);
if(FAILED(hr))
{
printf("MQCloseQueue() fail, error = 0x%X", hr);
return -1;
}
In this example, L"direct=http://cepc123.microsoft.com/msmq/private$/queue1" is the format name of the queue, where cepc123.microsoft.com is the destination host name, /msmq indicates a virtual folder in the receiving-side Web server, and /private$/queue1 indicates a private queue.
If you open a queue using L"direct=os:cepc123.microsoft.com\\private$\\queue1", the following MQSendMessage function sends the message using the native MSMQ protocol.
The other functions work almost the same as the native MSMQ protocol. Of course, the proprietary TCP-based MSMQ protocol is still supported.
Sending applications can control the various options associated with HTTP or the use of HTTPS for more secure communication. Additionally, you can send messages to a public queue without using the FRS if you use the HTTP queue name.
On the receiving end, MSMQ is closely integrated with a Web server.
Applications can map specific URLs to MSMQ queues and every message sent to that URL is inserted into the applicable queue by MSMQ. An MSMQ application can then use standard MSMQ APIs to obtain those messages.
There is no specific option needed to open this local queue on the receiver side.
See Also
MSMQ Application Development | Summary of Supported MSMQ Functions | Administration | MSMQ COM Support | Internet Messaging | SOAP Reliable Messaging Protocol | Message Routing | Message Conversion | MSMQ Security
Send Feedback on this topic to the authors