PubSub with MSMQ problem

Apr 4, 2011 at 6:28 PM

Hello !

I just made a copy of the working PubSub sample and changed the configured transport to be MSMQ.
But I cannot make it working and see rarely message in the queue and the server is not resolved.

I just made the client and the server this way:

using(var space = new XcoAppSpace(@"msmq.queuename=rx\private$\PubSubServer")) //server
    Port<PublishNews> port = space.RunWorker<PNewsAgency, TransientNewsAgency>("news");

using (var space = new XcoAppSpace(@"msmq.queuename=rx\private$\PubSubClient;msmq.disposequeue=false")) //client
    var w = space.ConnectWorker<PNewsAgency>(@"msmq.queuename=rx\private$\PubSubServer");

Although, the queues are there, the client throws this exception:

Unhandled Exception: XcoAppSpaces.Contracts.Exceptions.XcoCommunicationException: Worker
at msmq.queuename=rx\private$\PubSubServer with type PNewsAgency could not be resolved. Reason: NoResponse
   at XcoAppSpaces.Core.Communication.Connector.CheckWorkerResolveResponse(String workerAddress, Type workerType,
   ResolveResponse resolve) in d:\Development\Uni\XcoAppSpaces\source.implementation\XcoAppSpaces.Core.Communication\XcoAppSpaces
.Core.Communication\public\Connector.cs:line 203
   at XcoAppSpaces.Core.Communication.Connector.ConnectWorker[TContract](String name, String address, String commService
Name, ICredentials credentials) in d:\Development\Uni\XcoAppSpaces\source.implementation\XcoAppSpaces.Core.Communication
\XcoAppSpaces.Core.Communication\public\Connector.cs:line 161
   at XcoAppSpaces.Core.Communication.Connector.ConnectWorker[TContract](String workerAddress, String commServiceName, I
Credentials credentials) in d:\Development\Uni\XcoAppSpaces\source.implementation\XcoAppSpaces.Core.Communication\XcoApp
Spaces.Core.Communication\public\Connector.cs:line 138
   at XcoAppSpaces.Core.XcoAppSpace.ConnectWorker[TMessageContract](PublishMode publishMode, String commServiceName, Str
ing workerAddress, String localName) in d:\Development\Uni\XcoAppSpaces\source.implementation\XcoAppSpaces.Core\XcoAppSp
aces.Core\public\XcoAppSpace.cs:line 498
   at XcoAppSpaces.Core.XcoAppSpace.ConnectWorker[TMessageContract](String workerAddress) in d:\Development\Uni\XcoAppSp
aces\source.implementation\XcoAppSpaces.Core\XcoAppSpaces.Core\public\XcoAppSpace.cs:line 414
   at Client.Program.Main() in D:\Develop\Dev\Experimente\cs\Experimente\AppSpace\PubSub\V00\Client\Program.cs:line 22

Any help would be great!!

Additional note:If the queues created on a server [I am using "Windows Server 2008 R2"], the administrators
do not have control. On Windows XP, this is not an issue.


Apr 6, 2011 at 7:36 AM

Hi mabra,

I think there is just a slight error in your ConnectWorker call: As queue address, instead of writing @"msmq.queuename=rx\private$\PubSubServer", you just have to write @"rx\private$\PubSubServer" (because you don't use a config string, but only the name of the server queue). In the first case, the messages would tried to be sent to a queue with a name that doesn't exist, in which case MSMQ store these messages until a queue with this name is created, and therefore you don't receive any meaningful error message, but also the message will never reach your destined server queue.

A helpful thing here can be to view the queues with compmgmt.msc. There you can also see outgoing messages that couldn't yet be delivered - on your client you would in this case see a queue with the invalid name, saying something like "waiting for connection...".

Hope I could help you!


Apr 6, 2011 at 4:08 PM

Hi !

Thanks for your reply!

But sorry, I do not understand. I changed my client code to use:

using (var space = new XcoAppSpace(@"msmq.queuename=rx\private$\PubSubClient;msmq.disposequeue=false"))
    var w = space.ConnectWorker<PNewsAgency>(@"rx\private$\PubSubServer");    //removed "config"

and my server remains the same:

using(var space = new XcoAppSpace(@"msmq.queuename=rx\private$\PubSubServer"))
    Program.port = space.RunWorker<PNewsAgency, TransientNewsAgency>("news");

I am getting the same exception.

Unhandled Exception: XcoAppSpaces.Contracts.Exceptions.XcoCommunicationException: Worker at rx\private$\PubSubServer wit
h type PNewsAgency could not be resolved. Reason: WorkerNotFound

Additionally, not one messages appear in any queue
and there is not outgoing queue at all!

I remember my first experience with MSMQ ten years ago:It happens - continues until today [ -:( !!] - that
I am unable to recognize the different patterns of the queue names [a real pain for me].

BTW:I even deleted all queues manually and re-started MSMQ without that this changes something.


Apr 6, 2011 at 5:16 PM


In the original example - I derived from your "PubSub" sample using TCP as a transport - there is the following in the client:

using (var space = new XcoAppSpace("tcp.port=9001"))
    var w = space.ConnectWorker<PNewsAgency>("localhost:9000/news");    //=>"news" !!!!!!

My modified example - using mSMQ - has this:

using (var space = new XcoAppSpace(@"msmq.queuename=rx\private$\PubSubClient;msmq.disposequeue=false"))
    var w = space.ConnectWorker<PNewsAgency>(@"rx\private$\PubSubServer");  //WHERE IS "news" !!!???????

I tried even this overload:

using (var space = new XcoAppSpace(@"msmq.queuename=rx\private$\PubSubClient;msmq.disposequeue=false"))
    var w = space.ConnectWorker<PNewsAgency>(@"rx\private$\PubSubServer", "news");

without success.

This would use the following overload:

 TMessageContract ConnectWorker<TMessageContract>(string workerAddress, string localName)

Please:What is "localname"??

I start feeling bad with the configuration:Is there a common thing, like a "servicename", which will
describe what is the hosted service? Sorry, I really do not understand this.



Apr 6, 2011 at 10:31 PM

Hi !

Finally, found it.

Changed my modified MSMQ PubSub to:

My modified example - using mSMQ - has this:

using (var space = new XcoAppSpace(@"msmq.queuename=rx\private$\PubSubClient;msmq.disposequeue=false"))
    var w = space.ConnectWorker<PNewsAgency>(@"rx\private$\PubSubServer/news");

!!!!! Hi:What do I misunderstand here? I could really NOT imagine, that the queuename
contains news. I feel bad with this :-(

But anyway, first, thanks, to brought me onto the right track.

BTW:Would really want more detailed dosc and api-docs .... ;-)

Thanks anyway!


Apr 8, 2011 at 7:04 AM

Hi mabra,

Glad that you found the solution.

To clear things up a bit: The string for conneting to a worker is a combination of the appspace address where the worker is running (which is in your case the queue name), and the name of the worker, in form of "spaceaddress/workername" (if the worker doesn't have a name, the spaceaddress alone is enough). This scheme is used independent of the transport service - with MSMQ it may look a bit awkward - but we decided that it would be best to always stick to the same scheme for the "spaceaddress/workername" combination.

As for the ConnectWorker method overload with "localName": this is the name you assign to the worker in your local appspace instance. You may have noticed that the appspace has a Resolve() method, which lets you resolve local worker instances - once you have connected to a remote worker, you can also use Resolve() to get this worker proxy from your local appspace, using the defined local name. Like this:

space.ConnectWorker(@"rx\private$\PubSubServer/news", "mynews");

var worker = space.Resolve("mynews");

This can e.g. be useful if you want to connect to different workers of the same type, and therefore assign different names to them in your local appspace.