So my day job has been keeping me very busy (which is never a bad thing)...
I have managed to delve a little deeper into message queues, and although documentation exists, it can be a little ambiguous. Here is what I have found...
NAV and Message Queues
OutMsg := CC2.CreateoutMessage('Message queue://.\private$\TestWriteQueue');
OutS := OutMsg.GetStream();
OutS.WRITE('Hello world! - WritePrivateQueue');
The code above will write to a new private message queue on the local machine called: TestWriteQueue
The message is called: Navision MSMQ-BA
At the same time a message called: Navision MSMQ-BA is created in the public queue called: nsadminreceivequeue - not too sure what this one does or is as it is blank – it seems to be the admin queue used to deliver the message to the correct queue as it states – “The message reached the queue.”
InMsg := InMessage;
InS := InMsg.GetStream();
This code will receive the message sent by WritePrivateQueue and then display the text in message in NAV. This codeunit must be running single instance so that it can respond to the event.
OutS.WRITE('Hello world! - WritePrivateQueueandReply');
IF ISCLEAR(InMsg) THEN
MESSAGE('InMsg not received')
This time we wait for a response back after sending the machine.
The system is not receiving the reply!!!
A public queue is a queue that is registered in the directory service that any Message Queuing application can locate. Public queues are persistent. You can make a backup of their registration information, which makes them suitable for long-term use.
A private queue is a queue that is registered on the local computer (not in the directory service) that other applications typically cannot locate. Private queues have the advantage of having no directory service overhead. This means that they are faster to create, there is no latency and no replication. Further, they can be created and deleted when the directory service is not working.
Hi. Nice post.
I'm trying your code to receive a message from an external application to Navision however it doesn't read it. I can only write. I'm using your exact code in the onRun() trigger. Am i missing something?