Skip to content

Commit

Permalink
Disabling receiving is running in SendOnly mode
Browse files Browse the repository at this point in the history
Fixes #78
  • Loading branch information
John Simons committed Apr 16, 2015
1 parent eb55676 commit 7ce46ad
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/NServiceBus.SqlServer/Config/SqlServerTransportFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,19 @@ protected override void Configure(FeatureConfigurationContext context, string co
config.Configure(context, connectionStringWithSchema);
}

context.Container.ConfigureComponent<TransportNotifications>(DependencyLifecycle.SingleInstance);
context.Container.ConfigureComponent<SqlServerMessageSender>(DependencyLifecycle.InstancePerCall);
context.Container.ConfigureComponent<SqlServerQueueCreator>(DependencyLifecycle.InstancePerCall);

var errorQueue = ErrorQueueSettings.GetConfiguredErrorQueue(context.Settings);
context.Container.ConfigureComponent(b => new ReceiveStrategyFactory(b.Build<PipelineExecutor>(), b.Build<LocalConnectionParams>(), errorQueue), DependencyLifecycle.InstancePerCall);
if (!context.Settings.GetOrDefault<bool>("Endpoint.SendOnly"))
{
context.Container.ConfigureComponent<TransportNotifications>(DependencyLifecycle.SingleInstance);
context.Container.ConfigureComponent<SqlServerQueueCreator>(DependencyLifecycle.InstancePerCall);

var errorQueue = ErrorQueueSettings.GetConfiguredErrorQueue(context.Settings);
context.Container.ConfigureComponent(b => new ReceiveStrategyFactory(b.Build<PipelineExecutor>(), b.Build<LocalConnectionParams>(), errorQueue), DependencyLifecycle.InstancePerCall);

context.Container.ConfigureComponent<SqlServerPollingDequeueStrategy>(DependencyLifecycle.InstancePerCall);
context.Container.ConfigureComponent(b => new SqlServerStorageContext(b.Build<PipelineExecutor>(), b.Build<LocalConnectionParams>()), DependencyLifecycle.InstancePerUnitOfWork);
context.Container.ConfigureComponent<SqlServerPollingDequeueStrategy>(DependencyLifecycle.InstancePerCall);
context.Container.ConfigureComponent(b => new SqlServerStorageContext(b.Build<PipelineExecutor>(), b.Build<LocalConnectionParams>()), DependencyLifecycle.InstancePerUnitOfWork);
}
}
}

Expand Down

0 comments on commit 7ce46ad

Please sign in to comment.