NGinn and WCF

27 views
Skip to first unread message

ErikZ

unread,
Apr 10, 2014, 8:02:52 AM4/10/14
to nginn-me...@googlegroups.com
Hi, 

Have anyone used NGinn from WCF?
When clients call my WCF service I want to send out a message on the bus. It seem like a lot of duplicate work to create and start a new bus instance each time my service is called.
Maybe this is the only way to do it because Nginn is not threadsafe? Have anyone done anything like this?

Thanks!

Rafal Gwizdala

unread,
Apr 10, 2014, 9:01:42 AM4/10/14
to nginn-me...@googlegroups.com
Hi Erik, I'm not sure if I understand your problem and your conclusions.
1. NGinn-messagebus is totally independent from WCF, i mean it doesn't use WCF and doesn't affect WCF configuration in any way. There's nothing in nginn-messagebus that would conflict with WCF or force you to use particular setup. 
2. You don't have to create and start a new bus instance on each service call (this is rather a strange idea). Why don't you configure the message bus once and use it whenever your service is called?
3. I don't understand why you're implying that something is not threadsafe. I'm not aware of any API function that would not be thread safe, and sending messages is thread safe for sure. Message bus instance is a singleton, usually shared by all threads of the application, so it has to be thread safe.
Sorry if it doesn't answer your questions, but I need more details to diagnose the problem better. My first guess is that you're trying to do something against the design of the library (configuring new message bus on each service call).
Best regards
Rafal



--
You received this message because you are subscribed to the Google Groups "nginn-messagebus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nginn-messageb...@googlegroups.com.
To post to this group, send email to nginn-me...@googlegroups.com.
Visit this group at http://groups.google.com/group/nginn-messagebus.

Rafal Gwizdala

unread,
Apr 22, 2014, 3:01:28 AM4/22/14
to nginn-me...@googlegroups.com
Hi Erik

Yes, it's threadsafe. A signle instance shared by all threads is a standard configuration. 
There's one more trick I think you might find useful (i'm guessing from your questions because I have no idea what your configuration is): If your WCF services are only sending messages to external queues (I mean queues handled by other applications) and not receiving any incoming messages, you can configure the message bus in 'send only' mode. Then it will not need its own queue and will not spin up receiving threads. This can be enabled by calling MessageBusConfigurator.SetSendOnly.

Best regards,
RG



On Tue, Apr 22, 2014 at 8:45 AM, Erik Zetterqvist <...> wrote:
Thank you. It was probably a bad question. :)
What I should have asked is if Nginn is threadsafe? Is it ok to do "Send" and "Notify" on the same MessageBus-object from different thread at the same time?

Brett Bailey

unread,
Apr 28, 2014, 6:43:30 AM4/28/14
to nginn-me...@googlegroups.com
I have used it from WCF.

You have to have your message bus as a singleton (we used Ninject to manage this).

To avoid issues with IIS creating and stopping worker processes we only used the endpoint for sending messages.  We created a separate endpoint (a plain windows service) to handle any incoming messages.

Hope this helps

~Brett
Reply all
Reply to author
Forward
0 new messages