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("Get to work!")); -
Request-Response (1 to 1 Request, 1 to 1 Response):
var response = WcfServiceBus.Request<IMyServiceContract>(client => client.DoStuff("What is 1+1?"));or
ServiceEndpoint responseEndpoint; WcfServiceBus.Request<IMyServiceContract>(client => client.DoStuff("What is 1+1?"), responseEndpoint); -
Publish (1 to 0...N Request):
WcfServiceBus.Publish<IMyServiceContract>(client => client.DoStuff("Lunch is ready!")); -
Notify (1 to 1...N Request):
WcfServiceBus.Notify<IMyServiceContract>(client => client.DoStuff("Someone needs to get this job done!")); -
Probe (1 to 0...N Request, 0...N to 1 Response):
var responses = WcfServiceBus.Probe<IMyServiceContract>(client => client.DoStuff("Anyone There?"), TimeSpan.FromSeconds(30));or
ServiceEndpoint responseEndpoint;
WcfServiceBus.Probe<IMyServiceContract>(client => client.DoStuff("Anyone There?"), 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);
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>