views:

205

answers:

1

I have WCF Per-Call service wich provides data for clients and at the same time is integrated with NServiceBus.
All statefull objects are stored in UnityContainer wich is integrated into custom service host.
NServiceBus is configured in service host and uses same container as service instances.
Every client has its own instance context(described by Juval Lowy in his book in chapter about Durable Services).

If i need to send request over bus I just use some kind of dispatcher and wait response using Thread.Sleep().Since services are per-call this is ok afaik.
But I am confused a bit about messages from bus, that service must handle and provide them to clients. For some data like stock quotes I just update some kind of statefull object and and then, when clients invoke GetQuotesData() just provide data from this object. But there are numerous service messages like new quote added and etc.
At this moment I have an idea to implement something like "Postman daemon" =)) and store this type of messages in instance context. Then client will invoke "GetMail()",recieve those messages and parse them. Problem is that NServiceBus messages are "Interface based" and I cant pass them over WCF, so I need to convert them to types derieved from some abstract class.

Dunno what is best way to handle this situation. Will be very gratefull for any advice on this.

Thanks in advance.

+1  A: 

Have you considered a "pure" NServiceBus solution for communicating back to clients? NServiceBus already has that "Postman daemon" capability. NServiceBus messages don't have to be interfaces - you can use regular classes as well.

Hope that helps.

Udi Dahan
Yep. But we have numerous types of clients on diffirent platforms(including mobile), and I dont want to expose queues to them. Im trying to stick with idea of using NServiceBus inside our domain solely for service-to-service interaction, and all client-service communications are using WCF.
Alexey Anufriyev
Keep in mind that many of those limitations will be just as applicable when you try to implement callbacks and notifications with WCF.
Udi Dahan
Thanks=) But we decided to remove callbacks and such features. So now client just asks service for something, like sync data, get messages and etc. I really like how NSB works=)
Alexey Anufriyev