Skip to content

Commit

Permalink
Merge branch '4.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
John Simons committed Jul 22, 2013
2 parents 674e723 f762545 commit ec1b723
Show file tree
Hide file tree
Showing 40 changed files with 388 additions and 135 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 171,7 @@
<Compile Include="Retries\When_message_fails_with_retries_set_to_0.cs" />
<Compile Include="Retries\When_doing_flr_with_default_settings.cs" />
<Compile Include="Sagas\When_an_endpoint_replies_to_a_saga.cs" />
<Compile Include="Sagas\When_a_saga_is_started_by_an_event_published_by_another_saga.cs" />
<Compile Include="Sagas\When_receiving_a_message_that_is_mapped_to_an_existing_saga_instance.cs" />
<Compile Include="Sagas\When_two_sagas_subscribe_to_the_same_event.cs" />
<Compile Include="Sagas\When_using_a_received_message_for_timeout.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 1,142 @@
namespace NServiceBus.AcceptanceTests.Sagas
{
using System;
using EndpointTemplates;
using AcceptanceTesting;
using Features;
using NUnit.Framework;
using PubSub;
using Saga;
using ScenarioDescriptors;

//Repro for #1323
public class When_a_saga_is_started_by_an_event_published_by_another_saga
{
[Test]
public void Should_start_the_saga_and_request_a_timeout()
{
Scenario.Define<Context>()
.WithEndpoint<SagaThatPublishesAnEvent>(b =>
b.Given(
(bus, context) =>
Subscriptions.OnEndpointSubscribed(s =>
{
if (s.SubscriberReturnAddress.Queue.Contains("SagaThatIsStartedByTheEvent"))
{
context.IsEventSubscriptionReceived = true;
}
}))
.When(c => c.IsEventSubscriptionReceived,
bus =>
bus.SendLocal(new StartSaga {DataId = Guid.NewGuid()}))
)
.WithEndpoint<SagaThatIsStartedByTheEvent>(
b => b.Given((bus, context) => bus.Subscribe<SomethingHappenedEvent>()))

.Done(c => c.DidSaga1Complete && c.DidSaga2Complete)
.Repeat(r => r.For(Transports.Default))
.Should(c => Assert.True(c.DidSaga1Complete && c.DidSaga2Complete))
.Run();
}

public class Context : ScenarioContext
{
public bool DidSaga1Complete { get; set; }
public bool DidSaga2Complete { get; set; }
public bool IsEventSubscriptionReceived { get; set; }
}

public class SagaThatPublishesAnEvent : EndpointConfigurationBuilder
{
public SagaThatPublishesAnEvent()
{
EndpointSetup<DefaultServer>(c => Configure.Features.Disable<AutoSubscribe>());
}

public class Saga1 : Saga<Saga1.Saga1Data>, IAmStartedByMessages<StartSaga>, IHandleTimeouts<Saga1.Timeout1>
{
public Context Context { get; set; }

public void Handle(StartSaga message)
{
Data.DataId = message.DataId;

//Publish the event, which will start the second saga
Bus.Publish<SomethingHappenedEvent>(m => { m.DataId = message.DataId; });

//Request a timeout
RequestTimeout<Timeout1>(TimeSpan.FromSeconds(5));
}

public void Timeout(Timeout1 state)
{
MarkAsComplete();
Context.DidSaga1Complete = true;
}

public class Saga1Data : ContainSagaData
{
[Unique]
public Guid DataId { get; set; }
}

public class Timeout1
{
}
}
}

public class SagaThatIsStartedByTheEvent : EndpointConfigurationBuilder
{
public SagaThatIsStartedByTheEvent()
{
EndpointSetup<DefaultServer>(c => Configure.Features.Disable<AutoSubscribe>())
.AddMapping<SomethingHappenedEvent>(typeof(SagaThatPublishesAnEvent));

}

public class Saga2 : Saga<Saga2.Saga2Data>, IAmStartedByMessages<SomethingHappenedEvent>, IHandleTimeouts<Saga2.Saga2Timeout>
{
public Context Context { get; set; }

public void Handle(SomethingHappenedEvent message)
{
Data.DataId = message.DataId;

//Request a timeout
RequestTimeout<Saga2Timeout>(TimeSpan.FromSeconds(5));
}

public void Timeout(Saga2Timeout state)
{
MarkAsComplete();
Context.DidSaga2Complete = true;
}

public class Saga2Data : ContainSagaData
{
[Unique]
public Guid DataId { get; set; }
}

public class Saga2Timeout
{
}
}
}


[Serializable]
public class StartSaga : ICommand
{
public Guid DataId { get; set; }
}

[Serializable]
public class SomethingHappenedEvent : IEvent
{
public Guid DataId { get; set; }
}

}
}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 32,7 @@ top of things.

## Submitting Changes

* Sign the [Contributor License Agreement](http://nservicebus.com/contributors/signup).
* Sign the [Contributor License Agreement](http://www.particular.net/contributors-license-agreement-consent).
* Push your changes to a feature branch in your fork of the repository.
* Submit a pull request to the NServiceBus repository

Expand Down
4 changes: 2 additions & 2 deletions NuGet/NServiceBus.ActiveMQ/NServiceBus.ActiveMQ.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@
<title>NServiceBus ActiveMQ</title>
<version>4.0.0-alpha0</version>
<authors>NServiceBus Ltd</authors>
<owners>Udi Dahan, Andreas Ohlund, Jonathan Matheus, John Simons</owners>
<owners>Udi Dahan, Andreas Ohlund, John Simons</owners>
<licenseUrl>http://particular.net/LicenseAgreement</licenseUrl>
<projectUrl>http://particular.net/</projectUrl>
<iconUrl>http://s3.amazonaws.com/nuget.images/NServiceBus_32.png</iconUrl>
Expand All @@ -15,7 15,7 @@
<copyright>Copyright 2010-2013 NServiceBus. All rights reserved</copyright>
<tags>nservicebus servicebus msmq cqrs publish subscribe</tags>
<dependencies>
<dependency id="NServiceBus" version="4.0.0-alpha0" />
<dependency id="NServiceBus" version="[%VERSION%,5)" />
<dependency id="Apache.NMS" version="[1.5.1,2)" />
</dependencies>
</metadata>
Expand Down
4 changes: 2 additions & 2 deletions NuGet/NServiceBus.Autofac/NServiceBus.Autofac.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@
<title>NServiceBus Autofac</title>
<version>4.0.0-alpha0</version>
<authors>NServiceBus Ltd</authors>
<owners>Udi Dahan, Andreas Ohlund, Jonathan Matheus, John Simons</owners>
<owners>Udi Dahan, Andreas Ohlund, John Simons</owners>
<licenseUrl>http://particular.net/LicenseAgreement</licenseUrl>
<projectUrl>http://particular.net/</projectUrl>
<iconUrl>http://s3.amazonaws.com/nuget.images/NServiceBus_32.png</iconUrl>
Expand All @@ -16,7 16,7 @@
<tags>nservicebus servicebus msmq cqrs publish subscribe</tags>
<dependencies>
<dependency id="Autofac" version="[3.0.1,4)" />
<dependency id="NServiceBus" version="4.0.0-alpha0" />
<dependency id="NServiceBus" version="[%VERSION%]" />
</dependencies>
</metadata>
<files>
Expand Down
4 changes: 2 additions & 2 deletions NuGet/NServiceBus.Azure/NServiceBus.Azure.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@
<title>NServiceBus Azure</title>
<version>4.0.0-alpha0</version>
<authors>NServiceBus Ltd</authors>
<owners>Udi Dahan, Andreas Ohlund, Jonathan Matheus, John Simons</owners>
<owners>Udi Dahan, Andreas Ohlund, John Simons</owners>
<licenseUrl>http://particular.net/LicenseAgreement</licenseUrl>
<projectUrl>http://particular.net/</projectUrl>
<iconUrl>http://s3.amazonaws.com/nuget.images/NServiceBus_32.png</iconUrl>
Expand All @@ -15,7 15,7 @@
<copyright>Copyright 2010-2013 NServiceBus. All rights reserved</copyright>
<tags>nservicebus servicebus msmq cqrs publish subscribe</tags>
<dependencies>
<dependency id="NServiceBus" version="4.0.0-alpha0" />
<dependency id="NServiceBus" version="[%VERSION%]" />
<dependency id="Microsoft.WindowsAzure.ConfigurationManager" version="2.0.0.0" />
<dependency id="WindowsAzure.ServiceBus" version="2.0.1.0" />
<dependency id="WindowsAzure.Storage" version="2.0.5.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@
<title>NServiceBus CastleWindsor</title>
<version>4.0.0-alpha0</version>
<authors>NServiceBus Ltd</authors>
<owners>Udi Dahan, Andreas Ohlund, Jonathan Matheus, John Simons</owners>
<owners>Udi Dahan, Andreas Ohlund, John Simons</owners>
<licenseUrl>http://particular.net/LicenseAgreement</licenseUrl>
<projectUrl>http://particular.net/</projectUrl>
<iconUrl>http://s3.amazonaws.com/nuget.images/NServiceBus_32.png</iconUrl>
Expand All @@ -16,7 16,7 @@
<tags>nservicebus servicebus msmq cqrs publish subscribe</tags>
<dependencies>
<dependency id="Castle.Windsor" version="[3.2.0,4)" />
<dependency id="NServiceBus" version="4.0.0-alpha0" />
<dependency id="NServiceBus" version="[%VERSION%]" />
</dependencies>
</metadata>
<files>
Expand Down
4 changes: 2 additions & 2 deletions NuGet/NServiceBus.Host/NServiceBus.Host.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@
<title>NServiceBus Host</title>
<version>4.0.0-alpha0</version>
<authors>NServiceBus Ltd</authors>
<owners>Udi Dahan, Andreas Ohlund, Jonathan Matheus, John Simons</owners>
<owners>Udi Dahan, Andreas Ohlund, John Simons</owners>
<licenseUrl>http://particular.net/LicenseAgreement</licenseUrl>
<projectUrl>http://particular.net/</projectUrl>
<iconUrl>http://s3.amazonaws.com/nuget.images/NServiceBus_32.png</iconUrl>
Expand All @@ -16,7 16,7 @@
<tags>nservicebus servicebus msmq cqrs publish subscribe</tags>
<dependencies>
<dependency id="T4Scaffolding.Core" />
<dependency id="NServiceBus" version="4.0.0-alpha0" />
<dependency id="NServiceBus" version="[%VERSION%]" />
</dependencies>
</metadata>
<files>
Expand Down
4 changes: 2 additions & 2 deletions NuGet/NServiceBus.Host32/NServiceBus.Host32.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@
<title>NServiceBus Host32</title>
<version>4.0.0-alpha0</version>
<authors>NServiceBus Ltd</authors>
<owners>Udi Dahan, Andreas Ohlund, Jonathan Matheus, John Simons</owners>
<owners>Udi Dahan, Andreas Ohlund, John Simons</owners>
<licenseUrl>http://particular.net/LicenseAgreement</licenseUrl>
<projectUrl>http://particular.net/</projectUrl>
<iconUrl>http://s3.amazonaws.com/nuget.images/NServiceBus_32.png</iconUrl>
Expand All @@ -16,7 16,7 @@
<tags>nservicebus servicebus msmq cqrs publish subscribe</tags>
<dependencies>
<dependency id="T4Scaffolding.Core" />
<dependency id="NServiceBus" version="4.0.0-alpha0" />
<dependency id="NServiceBus" version="[%VERSION%]" />
</dependencies>
</metadata>
<files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@
<title>NServiceBus Hosting Azure HostProcess</title>
<version>4.0.0-alpha0</version>
<authors>NServiceBus Ltd</authors>
<owners>Udi Dahan, Andreas Ohlund, Jonathan Matheus, John Simons</owners>
<owners>Udi Dahan, Andreas Ohlund, John Simons</owners>
<licenseUrl>http://particular.net/LicenseAgreement</licenseUrl>
<projectUrl>http://particular.net/</projectUrl>
<iconUrl>http://s3.amazonaws.com/nuget.images/NServiceBus_32.png</iconUrl>
Expand All @@ -15,7 15,7 @@
<copyright>Copyright 2010-2013 NServiceBus. All rights reserved</copyright>
<tags>nservicebus servicebus msmq cqrs publish subscribe</tags>
<dependencies>
<dependency id="NServiceBus.Hosting.Azure" version="4.0.0-alpha0" />
<dependency id="NServiceBus.Hosting.Azure" version="[%VERSION%]" />
<dependency id="CommonServiceLocator" version="1.0" />
</dependencies>
</metadata>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@
<title>NServiceBus Hosting Azure</title>
<version>4.0.0-alpha0</version>
<authors>NServiceBus Ltd</authors>
<owners>Udi Dahan, Andreas Ohlund, Jonathan Matheus, John Simons</owners>
<owners>Udi Dahan, Andreas Ohlund, John Simons</owners>
<licenseUrl>http://particular.net/LicenseAgreement</licenseUrl>
<projectUrl>http://particular.net/</projectUrl>
<iconUrl>http://s3.amazonaws.com/nuget.images/NServiceBus_32.png</iconUrl>
Expand All @@ -15,7 15,7 @@
<copyright>Copyright 2010-2013 NServiceBus. All rights reserved</copyright>
<tags>nservicebus servicebus msmq cqrs publish subscribe</tags>
<dependencies>
<dependency id="NServiceBus.Azure" version="4.0.0-alpha0" />
<dependency id="NServiceBus.Azure" version="[%VERSION%]" />
</dependencies>
</metadata>
<files>
Expand Down
2 changes: 1 addition & 1 deletion NuGet/NServiceBus.Interfaces/NServiceBus.Interfaces.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@
<title>NServiceBus Interfaces</title>
<version>4.0.0-alpha0</version>
<authors>NServiceBus Ltd</authors>
<owners>Udi Dahan, Andreas Ohlund, Jonathan Matheus, John Simons</owners>
<owners>Udi Dahan, Andreas Ohlund, John Simons</owners>
<licenseUrl>http://particular.net/LicenseAgreement</licenseUrl>
<projectUrl>http://particular.net/</projectUrl>
<iconUrl>http://s3.amazonaws.com/nuget.images/NServiceBus_32.png</iconUrl>
Expand Down
4 changes: 2 additions & 2 deletions NuGet/NServiceBus.NHibernate/NServiceBus.NHibernate.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@
<title>NServiceBus NHibernate</title>
<version>4.0.0-alpha0</version>
<authors>NServiceBus Ltd</authors>
<owners>Udi Dahan, Andreas Ohlund, Jonathan Matheus, John Simons</owners>
<owners>Udi Dahan, Andreas Ohlund, John Simons</owners>
<licenseUrl>http://particular.net/LicenseAgreement</licenseUrl>
<projectUrl>http://particular.net/</projectUrl>
<iconUrl>http://s3.amazonaws.com/nuget.images/NServiceBus_32.png</iconUrl>
Expand All @@ -16,7 16,7 @@
<tags>nservicebus servicebus msmq cqrs publish subscribe</tags>
<dependencies>
<dependency id="NHibernate" version="[3.3.1.4000,4)" />
<dependency id="NServiceBus" version="4.0.0-alpha0" />
<dependency id="NServiceBus" version="[%VERSION%]" />
</dependencies>
</metadata>
<files>
Expand Down
4 changes: 2 additions & 2 deletions NuGet/NServiceBus.Ninject/NServiceBus.Ninject.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@
<title>NServiceBus Ninject</title>
<version>4.0.0-alpha0</version>
<authors>NServiceBus Ltd</authors>
<owners>Udi Dahan, Andreas Ohlund, Jonathan Matheus, John Simons</owners>
<owners>Udi Dahan, Andreas Ohlund, John Simons</owners>
<licenseUrl>http://particular.net/LicenseAgreement</licenseUrl>
<projectUrl>http://particular.net/</projectUrl>
<iconUrl>http://s3.amazonaws.com/nuget.images/NServiceBus_32.png</iconUrl>
Expand All @@ -18,7 18,7 @@
<dependency id="Ninject.Extensions.ContextPreservation" version="3.0.0.8" />
<dependency id="Ninject.Extensions.NamedScope" version="3.0.0.5" />
<dependency id="Ninject" version="[3.0.0.15,4)" />
<dependency id="NServiceBus" version="4.0.0-alpha0" />
<dependency id="NServiceBus" version="[%VERSION%]" />
</dependencies>
</metadata>
<files>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@
<title>NServiceBus Notifications</title>
<version>4.0.0-alpha0</version>
<authors>NServiceBus Ltd</authors>
<owners>Udi Dahan, Andreas Ohlund, Jonathan Matheus, John Simons</owners>
<owners>Udi Dahan, Andreas Ohlund, John Simons</owners>
<licenseUrl>http://particular.net/LicenseAgreement</licenseUrl>
<projectUrl>http://particular.net/</projectUrl>
<iconUrl>http://s3.amazonaws.com/nuget.images/NServiceBus_32.png</iconUrl>
Expand All @@ -15,7 15,7 @@
<copyright>Copyright 2010-2013 NServiceBus. All rights reserved</copyright>
<tags>nservicebus servicebus msmq cqrs publish subscribe</tags>
<dependencies>
<dependency id="NServiceBus" version="4.0.0-alpha0" />
<dependency id="NServiceBus" version="[%VERSION%,5)" />
</dependencies>
</metadata>
<files>
Expand Down
4 changes: 2 additions & 2 deletions NuGet/NServiceBus.RabbitMQ/NServiceBus.RabbitMQ.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@
<title>NServiceBus RabbitMQ</title>
<version>4.0.0-alpha0</version>
<authors>NServiceBus Ltd</authors>
<owners>Udi Dahan, Andreas Ohlund, Jonathan Matheus, John Simons</owners>
<owners>Udi Dahan, Andreas Ohlund, John Simons</owners>
<licenseUrl>http://particular.net/LicenseAgreement</licenseUrl>
<projectUrl>http://particular.net/</projectUrl>
<iconUrl>http://s3.amazonaws.com/nuget.images/NServiceBus_32.png</iconUrl>
Expand All @@ -15,7 15,7 @@
<copyright>Copyright 2010-2013 NServiceBus. All rights reserved</copyright>
<tags>nservicebus servicebus msmq cqrs publish subscribe</tags>
<dependencies>
<dependency id="NServiceBus" version="4.0.0-alpha0" />
<dependency id="NServiceBus" version="[%VERSION%,5)" />
<dependency id="RabbitMQ.Client" version="[3.0.0,4)" />
</dependencies>
</metadata>
Expand Down
Loading

0 comments on commit ec1b723

Please sign in to comment.