After some time I have problem I cannot solve myself in easy way and it is why I am asking our "worldwide shared NAV brain" called MIBUSO... 8)
I am working on some application using MSMQ within NAV. But I have problems with creation of the queue first time I want to use it. I have two possibilities:
MSMQ_BA.CreateQueue(...);
MSMQ_BA.OpenReceiveQueue(...,0,0);
If I use CreateQueue, the queue is created but next time it raise the error that the queue already exists. If I just use OpenReceiveQueue, first time, when the queue is not created, it show me error about insufficient permissions to create the queue. In documentation to the message bus component is written, that this command will create the queue if OS name is supplied.
I am using local queue (".\private$\queuename"). I am running it under Vista, but I tried to run NAV as administrator without success. Is there some way how to check if the queue exists without using external components? (just using the "standard" communication components). How you are solving that in your projects?
Manual creation is not possible, because the MSMQ is used on client side (all NAV clients).
Thanks for any tip...
Answers
<start quote>
IMSMQBusAdapter::OpenReceiveQueue
[...]
Parameter:
[In] Name
[In] Protocol
[In] Mode
Reflects the mode in which the queue will be opened. The mode options are:
0: DIRECT (default value) - see the MSDN Platform SDK (Opening Queues with a Direct Format Name) for further information.
1: PRIVATE
2: PUBLIC
When the protocol contains a value that has no meaning, the default OS protocol is used. When you set Mode to DIRECT, a FormatName (see below) is used. Any other Mode uses a PathName.
FormatName example: AddressSpecification\PRIVATE\QueueName (for private queues)
PathName example: .\Private$\myPrivateQueue
<end quote>
Maybe you need to use FormatName? Just my 2 cents.
I tried to use this formats:
But with negative effect. The errors differs in some cases (remote computer is not available - but I am using . or local comp. name 8) ). But the queue was never created automatically. My be Vista problem... ](*,)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
But if someone have better solution and want it to share it with us, please, post it.
8)
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
RIS Plus, LLC