Created
September 10, 2012 19:45
-
-
Save davybrion/3693352 to your computer and use it in GitHub Desktop.
code snippets for "Consuming Multiple Agatha Services" post
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<client> | |
<endpoint binding="basicHttpBinding" bindingConfiguration="firstServiceBinding" | |
contract="Agatha.Common.WCF.IWcfRequestProcessor" | |
name="firstService" /> | |
<endpoint binding="basicHttpBinding" bindingConfiguration="secondServiceBinding" | |
contract="Agatha.Common.WCF.IWcfRequestProcessor" | |
name="secondService" /> | |
</client> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FirstServiceProxy : Agatha.Common.WCF.AsyncRequestProcessorProxy | |
{ | |
public FirstServiceProxy() | |
: base("firstService", GetServiceUrl()) {} | |
private static string GetServiceUrl() | |
{ | |
// return the correct url from somewhere... | |
} | |
} | |
public class SecondServiceProxy : Agatha.Common.WCF.AsyncRequestProcessorProxy | |
{ | |
public SecondServiceProxy() | |
: base("secondService", GetServiceUrl()) {} | |
private static string GetServiceUrl() | |
{ | |
// return the correct url from somewhere... | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IFirstDispatcher : Agatha.Common.IAsyncRequestDispatcher {} | |
public class FirstDispatcher : Agatha.Common.AsyncRequestDispatcher, IFirstDispatcher | |
{ | |
public FirstDispatcher(FirstServiceProxy requestProcessor) : base(requestProcessor) { } | |
} | |
public interface ISecondDispatcher : Agatha.Common.IAsyncRequestDispatcher {} | |
public class SecondDispatcher : Agatha.Common.AsyncRequestDispatcher, ISecondDispatcher | |
{ | |
public SecondDispatcher(SecondServiceProxy requestProcessor) : base(requestProcessor) { } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IFirstDispatcherFactory : Agatha.Common.IAsyncRequestDispatcherFactory {} | |
public class FirstDispatcherFactory : IFirstDispatcherFactory | |
{ | |
public IAsyncRequestDispatcher CreateAsyncRequestDispatcher() | |
{ | |
return IoC.Container.Resolve<IFirstDispatcher>(); | |
} | |
} | |
public interface ISecondDispatcherFactory : Agatha.Common.IAsyncRequestDispatcherFactory {} | |
public class SecondDispatcherFactory : ISecondDispatcherFactory | |
{ | |
public IAsyncRequestDispatcher CreateAsyncRequestDispatcher() | |
{ | |
return IoC.Container.Resolve<ISecondDispatcher>(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment