Skip to content

Instantly share code, notes, and snippets.

@davybrion
Created September 10, 2012 19:45
Show Gist options
  • Save davybrion/3693352 to your computer and use it in GitHub Desktop.
Save davybrion/3693352 to your computer and use it in GitHub Desktop.
code snippets for "Consuming Multiple Agatha Services" post
<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>
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...
}
}
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) { }
}
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