Skip to content
BEllis edited this page Sep 18, 2012 · 3 revisions

Softweyr.WcfServiceBus

Extension to WCF allowing for simplified client access to services and a simplified "Service Bus" API.

The following SOA messaging patterns are supported (with examples),

  • Fire-and-forget: (1 to 1 Request):

    WcfServiceBus.Invoke<IMyServiceContract>(client => client.DoStuff("Hello World"));

  • Request-Response (1 to 1 Request, 1 to 1 Response):

    var response = WcfServiceBus.Request<IMyServiceContract>(client => client.DoStuff("Hello World"));

    or

    ServiceEndpoint responseEndpoint; WcfServiceBus.Request<IMyServiceContract>(client => client.DoStuff("Hello World"), responseEndpoint);
  • Publish (1 to 0...N Request):

    WcfServiceBus.Publish<IMyServiceContract>(client => client.DoStuff("Hello World"));

  • Notify (1 to 1...N Request):

    WcfServiceBus.Notify<IMyServiceContract>(client => client.DoStuff("Hello World"));

  • Probe (1 to 0...N Request, 0...N to 1 Response):

    var responses = WcfServiceBus.Probe<IMyServiceContract>(client => client.DoStuff("Hello World"), TimeSpan.FromSeconds(30)); or ServiceEndpoint responseEndpoint; WcfServiceBus.Probe<IMyServiceContract>(client => client.DoStuff("Hello World"), responseEndpoint);

Publish and Notify have the following utility methods that are supported when using the WcfServiceBus discovery proxy. Endpoint susbcriptions can however be simply added to the service.model/client section of a configuration file or manually added to the WcfServiceBus discovery proxy

  • Susbcribe

    WcfServiceBus.Subscribe<IMyServiceContract>();
    or
    ServiceEndpoint endpoint;
    WcfServiceBus.Subscribe<IMyServiceContract>(endpoint);

  • Unsubscribe

    WcfServiceBus.Unsubscribe<IMyServiceContract>();
    or
    ServiceEndpoint endpoint;
    WcfServiceBus.Unsubscribe<IMyServiceContract>(endpoint);

Endpoint Configuration

Adding endpoints to the client part of a configuration file is the easiest way to add client endpoints.

Note: the only caveate is you need to make sure every endpoint has a unique name.

<system.servicemodel> <client> </client> </system.servicemodel>

Clone this wiki locally
You can’t perform that action at this time.