Particular / NServiceBus

Build, version, and monitor better microservices with the most powerful service platform for .NET
https://particular.net/nservicebus/
Other
2.09k stars 648 forks source link

When using the SqlServer transport, disabling the timeout manager results in a raven exception #1716

Closed MeTitus closed 10 years ago

MeTitus commented 10 years ago

I have the following configuration

    {
        XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile));

        NServiceBus.SetLoggingLibrary.Log4Net();

        var builder = new ContainerBuilder();

        builder
            .RegisterAssemblyTypes(GetAllAssemblies())
            .Where(t => t.GetCustomAttributes(typeof(IocInjectionAttribute), false).Any())
            .AsSelf()
            .AsImplementedInterfaces();

        NServiceBus.Configure
            .With()
            .UseTransport<SqlServer>()
            .AutofacBuilder(builder.Build())
            .UnicastBus();

        NServiceBus.Configure.Features.Disable<NServiceBus.Features.Audit>();
        NServiceBus.Configure.Features.Disable<NServiceBus.Features.Sagas>();
    }

Which is failing with with the Raven related error as shown bellow.

{"Connection string name: 'code' could not be parsed, unknown option: 'source'"}

at Raven.Abstractions.Data.ConnectionStringParser1.ProcessConnectionStringOption(NetworkCredential networkCredentials, String key, String value) in c:\Builds\RavenDB-Stable\Raven.Abstractions\Data\ConnectionStringParser.cs:line 143 at Raven.Abstractions.Data.ConnectionStringParser1.Parse() in c:\Builds\RavenDB-Stable\Raven.Abstractions\Data\ConnectionStringParser.cs:line 157 at Raven.Client.Document.DocumentStore.ParseConnectionString(String connString) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\DocumentStore.cs:line 206 at NServiceBus.ConfigureRavenPersistence.RavenPersistenceWithConnectionString(Configure config, String connectionStringValue, String database) at NServiceBus.ConfigureRavenPersistence.RavenPersistence(Configure config) at NServiceBus.ConfigureTimeoutManager.UseRavenTimeoutPersister(Configure config) at NServiceBus.ConfigureRavenPersistence.b5() at NServiceBus.Config.InfrastructureServices.Enable[T]() at NServiceBus.Features.TimeoutManager.Initialize() at NServiceBus.Features.FeatureInitializer.<>cDisplayClass3.b2(Type t) at System.Collections.Generic.List1.ForEach(Action1 action) at NServiceBus.Configure.ForAllTypes[T](Action`1 action) at NServiceBus.Features.FeatureInitializer.InitializeFeatures() at NServiceBus.Features.FeatureInitializer.FinalizeConfiguration() at NServiceBus.Configure.b13(IFinalizeConfiguration t) at NServiceBus.Configure.<>cDisplayClass23`1.b20(Type t) at System.Collections.Generic.List1.ForEach(Action1 action) at NServiceBus.Configure.ForAllTypes[T](Action1 action) at NServiceBus.Configure.ActivateAndInvoke[T](Action1 action, Nullable1 thresholdForWarning) at NServiceBus.Configure.Initialize() at NServiceBus.Configure.CreateBus() at NServiceBus.Hosting.GenericHost.Start() at NServiceBus.Hosting.Windows.WindowsHost.Start() at NServiceBus.Hosting.Windows.Program.<>c__DisplayClassd.<Main>b__5(WindowsHost service) at Topshelf.Internal.ControllerDelegates1.StartActionObject(Object obj) at Topshelf.Internal.IsolatedServiceControllerWrapper1.<>c__DisplayClass2.<set_StartAction>b__1(TService service) at Topshelf.Internal.ServiceController1.<.cctor>b__1(ServiceController1 sc) at Magnum.StateMachine.LambdaAction1.Execute(T instance, Event event, Object parameter) at Magnum.StateMachine.EventActionList`1.Execute(T stateMachine, Event event, Object parameter)

I don't want support for sagas in this endpoint so I did not add these to the config:

            .UseNHibernateTimeoutPersister()
            .UseNHibernateSagaPersister()

If I add them and even after disabling the saga support:

NServiceBus.Configure.Features.Disable();

I still get the timeout queries in the log:

2013-10-25 17:22:33,620 [15] INFO NHibernate.Loader.Loader - SELECT this.Id as y0, this.Time as y1 FROM TimeoutEntity this WHERE this.Endpoint = @p0 and (this.Time >= @p1 and this.Time <= @p2) ORDER BY this.Time asc 2013-10-25 17:22:33,760 [15] INFO NHibernate.Loader.Loader - SELECT TOP (@p0) this.Id as Id00, this_.Destination as Destinat2_00, this_.SagaId as SagaId00, this_.State as State00, this_.Time as Time00, this_.CorrelationId as Correlat6_00, this_.Headers as Headers00, this_.Endpoint as Endpoint00 FROM TimeoutEntity this WHERE this.Endpoint = @p1 and this.Time > @p2 ORDER BY this.Time asc

Not sure, but something does not look right here.

Thanks

johnsimons commented 10 years ago

What do your connectionstrings look like in the config file?

On Tuesday, October 29, 2013, MeTitus wrote:

I have the following configuration

{
    XmlConfigurator.ConfigureAndWatch(new FileInfo(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile));

    NServiceBus.SetLoggingLibrary.Log4Net();

    var builder = new ContainerBuilder();

    builder
        .RegisterAssemblyTypes(GetAllAssemblies())
        .Where(t => t.GetCustomAttributes(typeof(IocInjectionAttribute), false).Any())
        .AsSelf()
        .AsImplementedInterfaces();

    NServiceBus.Configure
        .With()
        .UseTransport<SqlServer>()
        .AutofacBuilder(builder.Build())
        .UnicastBus();

    NServiceBus.Configure.Features.Disable<NServiceBus.Features.Audit>();
    NServiceBus.Configure.Features.Disable<NServiceBus.Features.Sagas>();
}

Which is failing with with the Raven related error as shown bellow.

{"Connection string name: 'code' could not be parsed, unknown option: 'source'"}

at Raven.Abstractions.Data.ConnectionStringParser1.ProcessConnectionStringOption(NetworkCredential networkCredentials, String key, String value) in c:\Builds\RavenDB-Stable\Raven.Abstractions\Data\ConnectionStringParser.cs:line 143 at Raven.Abstractions.Data.ConnectionStringParser1.Parse() in c:\Builds\RavenDB-Stable\Raven.Abstractions\Data\ConnectionStringParser.cs:line 157 at Raven.Client.Document.DocumentStore.ParseConnectionString(String connString) in c:\Builds\RavenDB-Stable\Raven.Client.Lightweight\Document\DocumentStore.cs:line 206 at NServiceBus.ConfigureRavenPersistence.RavenPersistenceWithConnectionString(Configure config, String connectionStringValue, String database) at NServiceBus.ConfigureRavenPersistence.RavenPersistence(Configure config) at NServiceBus.ConfigureTimeoutManager.UseRavenTimeoutPersister(Configure config) at NServiceBus.ConfigureRavenPersistence.b5() at NServiceBus.Config.InfrastructureServices.EnableT at NServiceBus.Features.TimeoutManager.Initialize() at NServiceBus.Features.FeatureInitializer.<>cDisplayClass3.b2(Type t) at System.Collections.Generic.List1.ForEach(Action1 action) at NServiceBus.Configure.ForAllTypesT at NServiceBus.Features.FeatureInitializer.InitializeFeatures() at NServiceBus.Features.FeatureInitializer.FinalizeConfiguration() at NServiceBus.Configure.b13(IFinalizeConfiguration t) at NServiceBus.Configure.<>cDisplayClass231.b20(Type t) at System.Collections.Generic.List1.ForEach(Action1 action) at NServiceBus.Configure.ForAllTypes[T](Action1 action) at NServiceBus.Configure.ActivateAndInvokeT at NServiceBus.Configure.Initialize() at NServiceBus.Configure.CreateBus() at NServiceBus.Hosting.GenericHost.Start() at NServiceBus.Hosting.Windows.WindowsHost.Start() at NServiceBus.Hosting.Windows.Program.<>cDisplayClassd.b5(WindowsHost service) at Topshelf.Internal.ControllerDelegates1.StartActionObject(Object obj) at Topshelf.Internal.IsolatedServiceControllerWrapper1.<>cDisplayClass2.b1(TService service) at Topshelf.Internal.ServiceController1.<.cctor>b__1(ServiceController1 sc) at Magnum.StateMachine.LambdaAction1.Execute(T instance, Event event, Object parameter) at Magnum.StateMachine.EventActionList1.Execute(T stateMachine, Event event, Object parameter)

I don't want support for sagas in this endpoint so I did not add these to the config:

        .UseNHibernateTimeoutPersister()
        .UseNHibernateSagaPersister()

If I add them and even after disabling the saga support:

NServiceBus.Configure.Features.Disable();

I still get the timeout queries in the log:

2013-10-25 17:22:33,620 [15] INFO NHibernate.Loader.Loader - SELECT this.Id as y0, this.Time as y1 FROM TimeoutEntity this WHERE this.Endpoint = @p0 https://github.com/p0 and (this.Time >= @p1https://github.com/p1and this.Time <= @p2 https://github.com/p2) ORDER BY this.Time asc 2013-10-25 17:22:33,760 [15] INFO NHibernate.Loader.Loader - SELECT TOP ( @p0 https://github.com/p0) this.Id as Id00, this_.Destination as Destinat2_00, this_.SagaId as SagaId00, this_.State as State00, this_.Time as Time00, this_.CorrelationId as Correlat6_00, this_.Headers as Headers00, this_.Endpoint as Endpoint00 FROM TimeoutEntity this WHERE this.Endpoint = @p1 https://github.com/p1and this.Time > @p2 https://github.com/p2 ORDER BY this.Time asc

Not sure, but something does not look right here.

Thanks

— Reply to this email directly or view it on GitHubhttps://github.com/Particular/NServiceBus/issues/1716 .

Regards John Simons NServiceBus

MeTitus commented 10 years ago

Hi John,

these are the ones I am using:

<add name="NServiceBus/Transport" connectionString="Data Source=***;Database=***;Trusted_Connection=no;User ID=***; Password=***;"/>
<add name="NServiceBus/Persistence" connectionString="Data Source=***;Database=***;Trusted_Connection=no;User ID=***; Password=***;"/>

Thanks

johnsimons commented 10 years ago

Remove NServiceBus/Persistence, I don't think u need it. That should fix your issue.

On Tuesday, October 29, 2013, MeTitus wrote:

Hi John,

these are the ones I am using:

Thanks

— Reply to this email directly or view it on GitHubhttps://github.com/Particular/NServiceBus/issues/1716#issuecomment-27290787 .

Regards John Simons NServiceBus

MeTitus commented 10 years ago

I removed the NServiceBus/Persistence key and updated the configuration, and it all seems to be working now. I just think that maybe you guys could make some changes so that, if the key is there but the configuration disables all the logic related to the persistence, then it should be ignored.

        NServiceBus.Configure
            .With()
            .UseTransport<SqlServer>()
            .AutofacBuilder(builder.Build())
            .UnicastBus();

        NServiceBus.Configure.Features.Disable<NServiceBus.Features.Audit>();
        NServiceBus.Configure.Features.Disable<NServiceBus.Features.Sagas>();
        NServiceBus.Configure.Features.Disable<NServiceBus.Features.TimeoutManager>();

Thanks a lot.

johnsimons commented 10 years ago

Yes agree, can u raise a new issue that describes that?

On Tuesday, October 29, 2013, MeTitus wrote:

I removed the NServiceBus/Persistence key and updated the configuration, and it all seems to be working now. I just think that maybe you guys could make some changes so that, if the key is there but the configuration disables all the logic related to the persistence, then it should be ignored.

    NServiceBus.Configure
        .With()
        .UseTransport<SqlServer>()
        .AutofacBuilder(builder.Build())
        .UnicastBus();

    NServiceBus.Configure.Features.Disable<NServiceBus.Features.Audit>();
    NServiceBus.Configure.Features.Disable<NServiceBus.Features.Sagas>();
    NServiceBus.Configure.Features.Disable<NServiceBus.Features.TimeoutManager>();

Thanks a lot.

— Reply to this email directly or view it on GitHubhttps://github.com/Particular/NServiceBus/issues/1716#issuecomment-27292864 .

Regards John Simons NServiceBus

MeTitus commented 10 years ago

Yes of course, no problem :)