In this simple example, we use a codeunit to initialize the Navision Communication Component, establish contact to the Navision MS-Message Queue Bus Adapter and send a document. This example does not include error handling.
For the purpose of this example, we have defined the following variables:
Variable Name |
Data Type |
Subtype |
MQBus |
Automation |
'Navision MS-Message Queue Bus Adapter'.MSMQBusAdapter |
CC2 |
Automation |
'Navision Communication Component version 2'.CommunicationComponent |
OutMsg |
Automation |
'Navision Communication Component version 2'.OutMessage |
OutS |
OutStream |
|
Note that in the following example, you can use .\MyQueue (instead of MyMessageQueueServer\MyQueue) if you have installed the Microsoft Message Queue Server on your local machine.
OnRun()
CREATE(CC2);
CREATE(MQBus);
CC2.AddBusAdapter(MQBus,1);
MQBus.OpenWriteQueue('MyMessageQueueServer\XML-requests',0,0);
MQBus.SenderAuthenticationLevel:= 2;
OutMsg := CC2.CreateoutMessage('Message queue://MyMessageQueueServer\XML-requests');
OutS := OutMsg.GetStream();
OutS.WRITE('Hello world!');
OutMsg.Send(0);