I'm trying out Rebus with the (external) timeoutservice.
The TimeoutService correctly sends back a TimeoutReply. Then the subscriber logs an error that the TimeoutReplyHandler cannot be invoked.
I'm using Autofac for dependency injection and use the following configuration to register the Handlers:
ContainerBuilder builder = new ContainerBuilder();
builder.RegisterAssemblyTypes(AppDomain.CurrentDomain.GetAssemblies())
.Where(t => t.GetInterfaces().Any(i => i.IsAssignableFrom(typeof(IHandleMessages))))
.AsImplementedInterfaces()
.InstancePerDependency()
.PropertiesAutowired();
var container = builder.Build();
adapter = new AutofacContainerAdapter(container);
The following exception is thrown:
Autofac.Core.DependencyResolutionException: None of the constructors found with 'Public binding flags' on type 'Rebus.Bus.TimeoutReplyHandler' can be invoked wi th the available services and parameters: Cannot resolve parameter 'Rebus.Bus.IHandleDeferredMessage handleDeferredMessage ' of constructor 'Void .ctor(Rebus.Bus.IHandleDeferredMessage)'. at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IC omponentContext context, IEnumerable
1 parameters) at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable1 parameters) at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifeti meScope currentOperationScope, IComponentRegistration registration, IEnumerable` 1 parameters)
The TimeoutReply is handled by the internal class TimeoutReplyHandler, which needs an IHandleDeferredMessage in the ctor. The internal class DeferredMessageReDispatcher implements IHandleDeferredMessage and needs the IBus in the ctor. IHandleDeferredMessage is also internal scoped.
How should I configure the autofac container to handle TimeoutReply?