Hi!
I am trying to reproduce the Commerce portal feature of starting a message queue handler/poller. I am quite new to Attain so I am not that confident with the code yet.
Anyway, I am able to start the cphandler and get the eventhandler function recognized/displayed in my codeunit. But I simply cannot keep it running. as soon as the onRun method has finished, the codeunit "stops", ie it will not keep polling the queue.
This goes for any kind of eventhandler I try to instantiate... Attain just kills them off.
I might mention that it of course works excellent when run from a form, but I wish to use the NAS.
I tried to find out how NAS starts up the cphandler and see if there is a timer involved, but gave up after digging thru the code an hour or two.
Could someone please give me a pointer on this one... is there anyone who tried something similar (and succeded)?
/ Kirne
0
Comments
If you look at the function, there is a codeunit call named 'MsgDispatcher'. Because there is an infinite loop occuring, this codeunit is called every couple of seconds (or whatever the polling rate of the NAS is). It therefore is always checking the Message Queue.
Start with Codeunit 1 (Application Mgmt.) and take a look at the NASHandler function. From there, some key codeunits are:
RequestHandler Codeunit Request Handler
MsgDispatcher Codeunit Synchronization
MailHandler Codeunit Mail Handler
Hopefully this will kind of point you in the right direction.
Vice President, Deployment Operations
Symbiant Technologies, Inc.
http://www.symbiantsolutions.com
In my case I have added my own codeunit which creates an automation (CPHandler) which then polls the message queue.
This is the only com object I have managed to keep alive like this, although I have my own objects which also support this kind of hosted server functionality. So really, my question is: is there any one who has been able to reproduce the behaviour of CPHandler with their own com objects?
Place the cursor under OnRun and choose Properties (SHIFT+F4).
To 'kill' it again, close the company or the client/NAS.
**
Globals:
Name DataType Subtype Length
NCC2 Automation 'Navision Communication Component version 2'.CommunicationComponent
MSMQBus Automation 'Navision MS-Message Queue Bus Adapter'.MSMQBusAdapter
NCC2InMsg Automation 'Navision Communication Component version 2'.InMessage
NCC2OutMsg Automation 'Navision Communication Component version 2'.OutMessage
DOM3 Automation 'Microsoft XML, v3.0'.DOMDocument30
InStr InStream
OutStr OutStream
Str Text 30
var Variant
***
Using two buttons on a Form calling SendHelloWorld() and SendXML() you may see it work.
Have fun.