Total Pageviews

Search This Blog

Thursday, November 22, 2007

Dynamics Ax 4.0 and MSMQ

Writing to a Queue using .Net System.Messaging Assembly

Pre-Requisites:
1. Create a private queue using Computer Management->Message Queuing->Private Queues.
2. In AOT, References, add reference to System.Messaging assembly.

This job sends a message to the created queue:

static void JobMSMQSend(Args _args)
{
System.Messaging.MessageQueue mqsend;
System.Messaging.Message mesg;
;
mqsend = new System.Messaging.MessageQueue('.\\private$\\ax2web');
mesg = new System.Messaging.Message();
mesg.set_Label('AXMesg');
mesg.set_Body('First Message from AX!');
mqsend.Send(mesg);
}

No comments: