My simple MSMQ app is not staying alive. When I compile the code into a multi-threaded DLL, install it into a COM+ Server Package, set it to "no" security on the app and the component, and then start it from the Component Services MMC,
I get this error in the Event Log:
1.The server {073EE47C-56D2-4D7A-9FAD-A25560974F4E} did not register with DCOM within the required timeout.
2.An unexpected error was returned by the MSMQ API function indicated. The following error message was retrieved from MSMQ.
MQOpenQueue : The queue does not exist, or you do not have sufficient permissions to perform the operation.
Server Application ID: {073EE47C-56D2-4D7A-9FAD-A25560974F4E}
Server Application Name: tstq
Error Code = 0xc00e0003 :
COM+ Services Internals Information:
File: .\msmqrt.cpp, Line: 177
I get this error straight from the MMC:
An error occured while processing the last operation. Error code 80080005 - Server execution failed. The event log may contain additional troubleshooting information.
The queue exists (I made it in the Computer Management snap-in), and I have some simple working code where I can pump messages into this private queue all day. I can see the messages are valid and alive if I look at them in the MSMQ GUI. Why is my VFP code not staying alive? I am logged on with local Administrators group rights/perms, and the component is set to live as the current logged on user. Win2K-SP2, VFP7-SP1.
main.prg:
#INCLUDE msmq.h
lcName = "private$\tstq$"
Clear
oQueueInfo = CreateObject( "MSMQ.MSMQQueueInfo" )
oQueueInfo.Pathname = ".\" + lcName
oMSMQEvent = CreateObject( "MSMQ.MSMQEvent" )
oComUtil = CreateObject( "VFPCOM.COMUtil" )
otstq = CreateObject( "tstq" )
oComUtil.BindEvents( oMSMQEvent , otstq )
oRecQueue = oQueueInfo.Open( MQ_RECEIVE_ACCESS , MQ_DENY_NONE )
oRecQueue.EnableNotification( oMSMQEvent , MQMSG_CURRENT , 1000 )
Read Events
Define Class tstq as Custom OLEPublic
Function Arrived(oQueue,Cursor)
oMsgRec = oQueue.PeekCurrent(,,0)
StrToFile( "Message arrived event: " + Transform(oMsgRec.AppSpecific),"e:\src\projects\tstq\" + Sys(3) +".txt" , 0 )
If oMsgRec.AppSpecific = 33
oMsgRec = oQueue.ReceiveCurrent(,,,0)
oMsgRec = oQueue.PeekCurrent(,,0)
oQueue.EnableNotification(oMSMQEvent,MQMSG_CURRENT,1000)
StrToFile ( oMsgRec.Label + Chr(13)+Chr(10)+;
oMsgRec.Body + Chr(13)+Chr(10) , "e:\src\projects\tstq\-" + Sys(3)+".txt" , 0 )
Else
oQueue.EnableNotification(oMSMQEvent,MQMSG_NEXT,1000)
EndIf
EndFunc
Function ArrivedError(Queue,ErrorCode,Cursor)
StrToFile( "Message arrived error" , "e:\src\projects\tstq\" + Sys(3) +".txt" , 0 )
EndFunc
EndDefine