├── .gitattributes
├── .gitignore
├── .nuget
├── NuGet.Config
├── NuGet.exe
└── NuGet.targets
├── 3MassTransit.sln
├── Configuration
├── BusInitializer.cs
├── Configuration.csproj
├── Properties
│ └── AssemblyInfo.cs
├── app.config
└── packages.config
├── Contracts
├── Contracts.csproj
├── IApproveOrder.cs
├── IOrder.cs
├── IOrderApproved.cs
├── IOrderRejected.cs
├── IPick.cs
├── IPicked.cs
├── Properties
│ └── AssemblyInfo.cs
└── packages.config
├── OrderApproval
├── App.config
├── ApproveConsumer.cs
├── OrderApproval.csproj
├── OrderApproved.cs
├── OrderRejected.cs
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
└── packages.config
├── PickService
├── App.config
├── OrderPicked.cs
├── PickConsumer.cs
├── PickService.csproj
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
└── packages.config
├── README.md
├── TestPublisher
├── App.config
├── Order.cs
├── OrderSender.csproj
├── Program.cs
├── Properties
│ └── AssemblyInfo.cs
└── packages.config
└── TestSubscriber
├── App.config
├── ApproveOrder.cs
├── OrderPick.cs
├── OrderSaga.cs
├── OrderSaga.csproj
├── Program.cs
├── Properties
└── AssemblyInfo.cs
└── packages.config
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | build_output/*
2 | build_artifacts/*
3 | *.suo
4 | *.user
5 | packages
6 | *.dotCover
7 |
8 | *.ncrunch*
9 |
10 | src/logs/*
11 |
12 | bin
13 | obj
14 | _ReSharper*
15 | src/Samples/HeavyLoad/logs
16 |
17 | *.csproj.user
18 | *.resharper.user
19 | *.resharper
20 | *.ReSharper
21 | *.cache
22 | *~
23 | *.swp
24 | *.bak
25 | *.orig
26 |
27 | packages
28 |
29 | TestResult.xml
30 | submit.xml
31 | tests/*
32 | SolutionVersion.cs
33 | src/SolutionVersion.cs
34 | tests
35 | doc/build/*
36 |
37 | # osx noise
38 | .DS_Store
39 |
40 | nuspecs/
41 |
--------------------------------------------------------------------------------
/.nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.nuget/NuGet.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RolandGuijt/masstransitdemos/09777dcebd3606bfc4cc4d73dafb58a50062d53a/.nuget/NuGet.exe
--------------------------------------------------------------------------------
/.nuget/NuGet.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(MSBuildProjectDirectory)\..\
5 |
6 |
7 | false
8 |
9 |
10 | false
11 |
12 |
13 | true
14 |
15 |
16 | false
17 |
18 |
19 |
20 |
21 |
22 |
26 |
27 |
28 |
29 |
30 | $([System.IO.Path]::Combine($(SolutionDir), ".nuget"))
31 |
32 |
33 |
34 |
35 | $(SolutionDir).nuget
36 |
37 |
38 |
39 | $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName.Replace(' ', '_')).config
40 | $(MSBuildProjectDirectory)\packages.$(MSBuildProjectName).config
41 |
42 |
43 |
44 | $(MSBuildProjectDirectory)\packages.config
45 | $(PackagesProjectConfig)
46 |
47 |
48 |
49 |
50 | $(NuGetToolsPath)\NuGet.exe
51 | @(PackageSource)
52 |
53 | "$(NuGetExePath)"
54 | mono --runtime=v4.0.30319 "$(NuGetExePath)"
55 |
56 | $(TargetDir.Trim('\\'))
57 |
58 | -RequireConsent
59 | -NonInteractive
60 |
61 | "$(SolutionDir) "
62 | "$(SolutionDir)"
63 |
64 |
65 | $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)
66 | $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols
67 |
68 |
69 |
70 | RestorePackages;
71 | $(BuildDependsOn);
72 |
73 |
74 |
75 |
76 | $(BuildDependsOn);
77 | BuildPackage;
78 |
79 |
80 |
81 |
82 |
83 |
84 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
99 |
100 |
103 |
104 |
105 |
106 |
108 |
109 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
141 |
142 |
143 |
144 |
145 |
--------------------------------------------------------------------------------
/3MassTransit.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 2013
4 | VisualStudioVersion = 12.0.31101.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contracts", "Contracts\Contracts.csproj", "{C3D28C73-4DB9-430A-8673-93B97C664915}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Configuration", "Configuration\Configuration.csproj", "{68BAD11F-9680-419F-9567-91728CCDAEAD}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrderSender", "TestPublisher\OrderSender.csproj", "{AD366E76-3C4F-49C9-AA03-36FE23580E37}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrderSaga", "TestSubscriber\OrderSaga.csproj", "{DC337CC9-51BD-4A20-9094-631017F570BB}"
13 | EndProject
14 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{43D954D2-0F29-4BC4-8CFD-758345BC504E}"
15 | ProjectSection(SolutionItems) = preProject
16 | .nuget\NuGet.Config = .nuget\NuGet.Config
17 | .nuget\NuGet.exe = .nuget\NuGet.exe
18 | .nuget\NuGet.targets = .nuget\NuGet.targets
19 | EndProjectSection
20 | EndProject
21 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PickService", "PickService\PickService.csproj", "{AB7A6520-2303-4AC5-80CE-012E0E220B95}"
22 | EndProject
23 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrderApproval", "OrderApproval\OrderApproval.csproj", "{434CE008-C72C-406B-BBDB-304DD08AE829}"
24 | EndProject
25 | Global
26 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
27 | Debug|Any CPU = Debug|Any CPU
28 | Release|Any CPU = Release|Any CPU
29 | EndGlobalSection
30 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
31 | {C3D28C73-4DB9-430A-8673-93B97C664915}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
32 | {C3D28C73-4DB9-430A-8673-93B97C664915}.Debug|Any CPU.Build.0 = Debug|Any CPU
33 | {C3D28C73-4DB9-430A-8673-93B97C664915}.Release|Any CPU.ActiveCfg = Release|Any CPU
34 | {C3D28C73-4DB9-430A-8673-93B97C664915}.Release|Any CPU.Build.0 = Release|Any CPU
35 | {68BAD11F-9680-419F-9567-91728CCDAEAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
36 | {68BAD11F-9680-419F-9567-91728CCDAEAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
37 | {68BAD11F-9680-419F-9567-91728CCDAEAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
38 | {68BAD11F-9680-419F-9567-91728CCDAEAD}.Release|Any CPU.Build.0 = Release|Any CPU
39 | {AD366E76-3C4F-49C9-AA03-36FE23580E37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
40 | {AD366E76-3C4F-49C9-AA03-36FE23580E37}.Debug|Any CPU.Build.0 = Debug|Any CPU
41 | {AD366E76-3C4F-49C9-AA03-36FE23580E37}.Release|Any CPU.ActiveCfg = Release|Any CPU
42 | {AD366E76-3C4F-49C9-AA03-36FE23580E37}.Release|Any CPU.Build.0 = Release|Any CPU
43 | {DC337CC9-51BD-4A20-9094-631017F570BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
44 | {DC337CC9-51BD-4A20-9094-631017F570BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
45 | {DC337CC9-51BD-4A20-9094-631017F570BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
46 | {DC337CC9-51BD-4A20-9094-631017F570BB}.Release|Any CPU.Build.0 = Release|Any CPU
47 | {AB7A6520-2303-4AC5-80CE-012E0E220B95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
48 | {AB7A6520-2303-4AC5-80CE-012E0E220B95}.Debug|Any CPU.Build.0 = Debug|Any CPU
49 | {AB7A6520-2303-4AC5-80CE-012E0E220B95}.Release|Any CPU.ActiveCfg = Release|Any CPU
50 | {AB7A6520-2303-4AC5-80CE-012E0E220B95}.Release|Any CPU.Build.0 = Release|Any CPU
51 | {434CE008-C72C-406B-BBDB-304DD08AE829}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
52 | {434CE008-C72C-406B-BBDB-304DD08AE829}.Debug|Any CPU.Build.0 = Debug|Any CPU
53 | {434CE008-C72C-406B-BBDB-304DD08AE829}.Release|Any CPU.ActiveCfg = Release|Any CPU
54 | {434CE008-C72C-406B-BBDB-304DD08AE829}.Release|Any CPU.Build.0 = Release|Any CPU
55 | EndGlobalSection
56 | GlobalSection(SolutionProperties) = preSolution
57 | HideSolutionNode = FALSE
58 | EndGlobalSection
59 | EndGlobal
60 |
--------------------------------------------------------------------------------
/Configuration/BusInitializer.cs:
--------------------------------------------------------------------------------
1 | using MassTransit;
2 | using MassTransit.BusConfigurators;
3 | using MassTransit.Log4NetIntegration.Logging;
4 | using System;
5 |
6 | namespace Configuration
7 | {
8 | public class BusInitializer
9 | {
10 | public static IServiceBus CreateBus(string queueName, Action moreInitialization)
11 | {
12 | Log4NetLogger.Use();
13 | var bus = ServiceBusFactory.New(x =>
14 | {
15 | x.UseRabbitMq();
16 | x.ReceiveFrom(GetUri(queueName));
17 | moreInitialization(x);
18 | });
19 |
20 | return bus;
21 | }
22 |
23 | public static Uri GetUri(string queueName)
24 | {
25 | return new Uri("rabbitmq://localhost/NDC/" + queueName);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Configuration/Configuration.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {68BAD11F-9680-419F-9567-91728CCDAEAD}
8 | Library
9 | Properties
10 | Configuration
11 | Configuration
12 | v4.5
13 | 512
14 | ..\
15 | true
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 | ..\packages\log4net.2.0.3\lib\net40-full\log4net.dll
37 |
38 |
39 | False
40 | ..\packages\Magnum.2.1.3\lib\NET40\Magnum.dll
41 |
42 |
43 | False
44 | ..\packages\MassTransit.2.10.0\lib\net40\MassTransit.dll
45 |
46 |
47 | ..\packages\MassTransit.Log4Net.2.9.5\lib\net40\MassTransit.Log4NetIntegration.dll
48 |
49 |
50 | ..\packages\MassTransit.RabbitMQ.2.9.5\lib\net40\MassTransit.Transports.RabbitMq.dll
51 |
52 |
53 | False
54 | ..\packages\Newtonsoft.Json.6.0.6\lib\net45\Newtonsoft.Json.dll
55 |
56 |
57 | ..\packages\RabbitMQ.Client.3.2.1\lib\net30\RabbitMQ.Client.dll
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
80 |
81 |
82 |
83 |
90 |
--------------------------------------------------------------------------------
/Configuration/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Configuration")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Configuration")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("3f35020b-2047-4297-8371-f3dbbcb3d304")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Configuration/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Configuration/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Contracts/Contracts.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {C3D28C73-4DB9-430A-8673-93B97C664915}
8 | Library
9 | Properties
10 | Contracts
11 | Contracts
12 | v4.5
13 | 512
14 | ..\
15 | true
16 |
17 |
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 | ..\packages\Magnum.2.1.3\lib\NET40\Magnum.dll
37 |
38 |
39 | ..\packages\MassTransit.2.10.0\lib\net40\MassTransit.dll
40 |
41 |
42 | ..\packages\Newtonsoft.Json.6.0.6\lib\net45\Newtonsoft.Json.dll
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
69 |
70 |
71 |
72 |
79 |
--------------------------------------------------------------------------------
/Contracts/IApproveOrder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using MassTransit;
3 |
4 | namespace Contracts
5 | {
6 | public interface IApproveOrder: CorrelatedBy
7 | {
8 | string Text { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/Contracts/IOrder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using MassTransit;
3 |
4 | namespace Contracts
5 | {
6 | public interface IOrder: CorrelatedBy
7 | {
8 | string What { get; }
9 | DateTime When { get; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Contracts/IOrderApproved.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using MassTransit;
3 |
4 | namespace Contracts
5 | {
6 | public interface IOrderApproved: CorrelatedBy
7 | {
8 | string Text { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/Contracts/IOrderRejected.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using MassTransit;
3 |
4 | namespace Contracts
5 | {
6 | public interface IOrderRejected : CorrelatedBy
7 | {
8 | string Text { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/Contracts/IPick.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using MassTransit;
3 |
4 | namespace Contracts
5 | {
6 | public interface IPick : CorrelatedBy
7 | {
8 | string What { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/Contracts/IPicked.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using MassTransit;
3 |
4 | namespace Contracts
5 | {
6 | public interface IPicked: CorrelatedBy
7 | {
8 | string Text { get; set; }
9 | }
10 | }
--------------------------------------------------------------------------------
/Contracts/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Contracts")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Contracts")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("5380a571-c590-45f9-a182-c7896e2ab669")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Contracts/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OrderApproval/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/OrderApproval/ApproveConsumer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using Contracts;
4 | using MassTransit;
5 |
6 | namespace OrderApproval
7 | {
8 | public class ApproveConsumer : Consumes.All
9 | {
10 | private readonly IServiceBus bus;
11 |
12 | public ApproveConsumer(IServiceBus bus)
13 | {
14 | this.bus = bus;
15 | }
16 |
17 | public void Consume(IApproveOrder message)
18 | {
19 | Console.WriteLine("Approving order {0}", message.Text);
20 | Thread.Sleep(1000);
21 | if (true) {
22 | bus.Publish(new OrderApproved {Text = message.Text, CorrelationId = message.CorrelationId});
23 | return;
24 | }
25 | bus.Publish(new OrderRejected { Text = message.Text, CorrelationId = message.CorrelationId });
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/OrderApproval/OrderApproval.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {434CE008-C72C-406B-BBDB-304DD08AE829}
8 | Exe
9 | Properties
10 | OrderApproval
11 | OrderApproval
12 | v4.5
13 | 512
14 | ..\
15 | true
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 | ..\packages\Autofac.3.5.2\lib\net40\Autofac.dll
39 |
40 |
41 | ..\packages\Magnum.2.1.3\lib\NET40\Magnum.dll
42 |
43 |
44 | ..\packages\MassTransit.2.10.0\lib\net40\MassTransit.dll
45 |
46 |
47 | ..\packages\MassTransit.Autofac.2.10.0\lib\net40\MassTransit.AutofacIntegration.dll
48 |
49 |
50 | ..\packages\MassTransit.RabbitMQ.2.9.5\lib\net40\MassTransit.Transports.RabbitMq.dll
51 |
52 |
53 | ..\packages\Newtonsoft.Json.6.0.6\lib\net45\Newtonsoft.Json.dll
54 |
55 |
56 | ..\packages\RabbitMQ.Client.3.2.1\lib\net30\RabbitMQ.Client.dll
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | {68bad11f-9680-419f-9567-91728ccdaead}
80 | Configuration
81 |
82 |
83 | {c3d28c73-4db9-430a-8673-93b97c664915}
84 | Contracts
85 |
86 |
87 |
88 |
89 |
90 |
91 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
92 |
93 |
94 |
95 |
102 |
--------------------------------------------------------------------------------
/OrderApproval/OrderApproved.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Contracts;
3 |
4 | namespace OrderApproval
5 | {
6 | class OrderApproved: IOrderApproved
7 | {
8 | public string Text { get; set; }
9 | public Guid CorrelationId { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/OrderApproval/OrderRejected.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Contracts;
3 |
4 | namespace OrderApproval
5 | {
6 | public class OrderRejected: IOrderRejected
7 | {
8 | public string Text { get; set; }
9 | public Guid CorrelationId { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/OrderApproval/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Autofac;
3 | using Configuration;
4 | using MassTransit;
5 |
6 | namespace OrderApproval
7 | {
8 | class Program
9 | {
10 | static void Main(string[] args)
11 | {
12 | var builder = new ContainerBuilder();
13 |
14 | builder.RegisterType().AsSelf();
15 |
16 | builder.Register(c => ServiceBusFactory.New(sbc =>
17 | {
18 | sbc.UseRabbitMq();
19 | sbc.ReceiveFrom(BusInitializer.GetUri("OrderApprover"));
20 |
21 | sbc.SetConcurrentConsumerLimit(5);
22 | sbc.SetDefaultRetryLimit(5);
23 |
24 | //this will find all of the consumers in the container and
25 | //register them with the bus.
26 | sbc.Subscribe(x => x.LoadFrom(c.Resolve()));
27 | })).As().SingleInstance().AutoActivate();
28 |
29 | builder.Build();
30 |
31 | Console.WriteLine("Waiting..");
32 | Console.ReadKey();
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/OrderApproval/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("OrderApproval")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("OrderApproval")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("9f065c16-7d57-4771-9d57-d3b831f40729")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/OrderApproval/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/PickService/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/PickService/OrderPicked.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Contracts;
3 |
4 | namespace PickService
5 | {
6 | public class OrderPicked: IPicked
7 | {
8 | public Guid CorrelationId { get; set; }
9 | public string Text { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/PickService/PickConsumer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using Contracts;
4 | using MassTransit;
5 |
6 | namespace PickService
7 | {
8 | public class PickConsumer : Consumes.All
9 | {
10 | private readonly IServiceBus bus;
11 |
12 | public PickConsumer(IServiceBus bus)
13 | {
14 | this.bus = bus;
15 | }
16 |
17 | public void Consume(IPick message)
18 | {
19 | Console.WriteLine("Pick order {0}", message.What);
20 | Thread.Sleep(1000);
21 | bus.Publish(new OrderPicked {CorrelationId = message.CorrelationId, Text = message.What});
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/PickService/PickService.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {AB7A6520-2303-4AC5-80CE-012E0E220B95}
8 | Exe
9 | Properties
10 | PickService
11 | PickService
12 | v4.5
13 | 512
14 | ..\
15 | true
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 | ..\packages\Autofac.3.5.2\lib\net40\Autofac.dll
39 |
40 |
41 | ..\packages\Magnum.2.1.3\lib\NET40\Magnum.dll
42 |
43 |
44 | ..\packages\MassTransit.2.10.0\lib\net40\MassTransit.dll
45 |
46 |
47 | ..\packages\MassTransit.Autofac.2.10.0\lib\net40\MassTransit.AutofacIntegration.dll
48 |
49 |
50 | ..\packages\MassTransit.RabbitMQ.2.9.5\lib\net40\MassTransit.Transports.RabbitMq.dll
51 |
52 |
53 | ..\packages\Newtonsoft.Json.6.0.6\lib\net45\Newtonsoft.Json.dll
54 |
55 |
56 | ..\packages\RabbitMQ.Client.3.2.1\lib\net30\RabbitMQ.Client.dll
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | {68bad11f-9680-419f-9567-91728ccdaead}
79 | Configuration
80 |
81 |
82 | {c3d28c73-4db9-430a-8673-93b97c664915}
83 | Contracts
84 |
85 |
86 |
87 |
88 |
89 |
90 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
91 |
92 |
93 |
94 |
101 |
--------------------------------------------------------------------------------
/PickService/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Autofac;
3 | using Configuration;
4 | using MassTransit;
5 |
6 | namespace PickService
7 | {
8 | class Program
9 | {
10 | static void Main(string[] args)
11 | {
12 | var builder = new ContainerBuilder();
13 |
14 | // register each consumer manually
15 | builder.RegisterType().AsSelf();
16 |
17 | //or use Autofac's scanning capabilities -- SomeClass is any class in the correct assembly
18 | //builder.RegisterAssemblyTypes(typeof(PickConsumer).Assembly)
19 | // .Where(t => t.Implements())
20 | // .AsSelf();
21 |
22 | //now we add the bus
23 | builder.Register(c => ServiceBusFactory.New(sbc =>
24 | {
25 | sbc.UseRabbitMq();
26 | sbc.ReceiveFrom(BusInitializer.GetUri("PickService"));
27 |
28 | //this will find all of the consumers in the container and
29 | //register them with the bus.
30 | sbc.Subscribe(x => x.LoadFrom(c.Resolve()));
31 | })).As().SingleInstance().AutoActivate();
32 |
33 | builder.Build();
34 |
35 | Console.WriteLine("Waiting..");
36 | Console.ReadKey();
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/PickService/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("PickService")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("PickService")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("97c0a554-f684-420a-9351-8bb31bb160d2")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/PickService/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | A Simple MassTransit Publish/Subscribe Example
2 | ==============================================
3 |
4 | This is the example code to go with a [blog post on LooselyCoupledLabs.com](http://looselycoupledlabs.com/2014/06/masstransit-publish-subscribe-example/).
5 |
6 | David
7 |
--------------------------------------------------------------------------------
/TestPublisher/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/TestPublisher/Order.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Contracts;
3 |
4 | namespace OrderSender
5 | {
6 | public class Order : IOrder
7 | {
8 | public string What { get; set; }
9 | public DateTime When { get; set; }
10 | public Guid CorrelationId { get; set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/TestPublisher/OrderSender.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {AD366E76-3C4F-49C9-AA03-36FE23580E37}
8 | Exe
9 | Properties
10 | OrderSender
11 | OrderSender
12 | v4.5
13 | 512
14 | ..\
15 | true
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 | False
39 | ..\packages\Magnum.2.1.3\lib\NET40\Magnum.dll
40 |
41 |
42 | False
43 | ..\packages\MassTransit.2.10.0\lib\net40\MassTransit.dll
44 |
45 |
46 | False
47 | ..\packages\Newtonsoft.Json.6.0.6\lib\net45\Newtonsoft.Json.dll
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 | {68bad11f-9680-419f-9567-91728ccdaead}
69 | Configuration
70 |
71 |
72 | {c3d28c73-4db9-430a-8673-93b97c664915}
73 | Contracts
74 |
75 |
76 |
77 |
78 |
79 |
80 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
81 |
82 |
83 |
84 |
91 |
--------------------------------------------------------------------------------
/TestPublisher/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Configuration;
3 |
4 | namespace OrderSender
5 | {
6 | internal class Program
7 | {
8 | private static void Main(string[] args)
9 | {
10 | using (var bus = BusInitializer.CreateBus("OrderSender", x => { }))
11 | {
12 | var text = "";
13 |
14 | while (text != "quit")
15 | {
16 | Console.Write("Enter an order: ");
17 | text = Console.ReadLine();
18 |
19 | var message = new Order {What = text, When = DateTime.Now, CorrelationId = Guid.NewGuid()};
20 | var receiverUri = BusInitializer.GetUri("OrderSaga");
21 |
22 | bus.GetEndpoint(receiverUri)
23 | .Send(message);
24 | }
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/TestPublisher/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("TestPublisher")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("TestPublisher")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("70dcb7c0-39d8-457a-8f31-5988ba2f9a02")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/TestPublisher/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/TestSubscriber/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/TestSubscriber/ApproveOrder.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Contracts;
3 |
4 | namespace OrderSaga
5 | {
6 | public class ApproveOrder: IApproveOrder
7 | {
8 | public string Text { get; set; }
9 | public Guid CorrelationId { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/TestSubscriber/OrderPick.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Contracts;
3 |
4 | namespace OrderSaga
5 | {
6 | public class OrderPick: IPick
7 | {
8 | public string What { get; set; }
9 |
10 | public Guid CorrelationId { get; set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/TestSubscriber/OrderSaga.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Contracts;
3 | using Magnum.StateMachine;
4 | using MassTransit;
5 | using MassTransit.Saga;
6 |
7 | namespace OrderSaga
8 | {
9 | public class OrderSaga: SagaStateMachine, ISaga
10 | {
11 | static OrderSaga()
12 | {
13 | Define(() =>
14 | {
15 | Initially(
16 | When((Create))
17 | .Then((saga, message) => Console.WriteLine("{0}: Order created, sending approval request", message.What))
18 | .Publish((saga, message) => new ApproveOrder { Text = message.What, CorrelationId = saga.CorrelationId })
19 | .TransitionTo(Approve));
20 | During(Approve,
21 | When(Approved)
22 | .Then((saga, message) => Console.WriteLine("{0}: Approval received, sending pick request", message.Text))
23 | .Publish((saga, message) => new OrderPick { What = message.Text, CorrelationId = saga.CorrelationId })
24 | .TransitionTo(Pick),
25 | When(Rejected)
26 | .Complete());
27 | During(Pick,
28 | When(Picked)
29 | .Then((saga, message) => Console.WriteLine("{0}: Picking complete, workflow ends", message.Text))
30 | .Complete());
31 | });
32 | }
33 |
34 | public OrderSaga(Guid correlationId)
35 | {
36 | CorrelationId = correlationId;
37 | }
38 |
39 | public Guid CorrelationId { get; set; }
40 | public IServiceBus Bus { get; set; }
41 |
42 | public static State Initial { get; set; }
43 | public static State Approve { get; set; }
44 | public static State Pick { get; set; }
45 | public static State Completed { get; set; }
46 |
47 | public static Event Create { get; set; }
48 | public static Event Approved { get; set; }
49 | public static Event Rejected { get; set; }
50 | public static Event Picked { get; set; }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/TestSubscriber/OrderSaga.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {DC337CC9-51BD-4A20-9094-631017F570BB}
8 | Exe
9 | Properties
10 | OrderSaga
11 | OrderSaga
12 | v4.5
13 | 512
14 | ..\
15 | true
16 |
17 |
18 | AnyCPU
19 | true
20 | full
21 | false
22 | bin\Debug\
23 | DEBUG;TRACE
24 | prompt
25 | 4
26 |
27 |
28 | AnyCPU
29 | pdbonly
30 | true
31 | bin\Release\
32 | TRACE
33 | prompt
34 | 4
35 |
36 |
37 |
38 | ..\packages\Autofac.3.5.2\lib\net40\Autofac.dll
39 |
40 |
41 | False
42 | ..\packages\Magnum.2.1.3\lib\NET40\Magnum.dll
43 |
44 |
45 | False
46 | ..\packages\MassTransit.2.10.0\lib\net40\MassTransit.dll
47 |
48 |
49 | ..\packages\MassTransit.Autofac.2.10.0\lib\net40\MassTransit.AutofacIntegration.dll
50 |
51 |
52 | False
53 | ..\packages\MassTransit.RabbitMQ.2.9.5\lib\net40\MassTransit.Transports.RabbitMq.dll
54 |
55 |
56 | False
57 | ..\packages\Newtonsoft.Json.6.0.6\lib\net45\Newtonsoft.Json.dll
58 |
59 |
60 | False
61 | ..\packages\RabbitMQ.Client.3.2.1\lib\net30\RabbitMQ.Client.dll
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | {68bad11f-9680-419f-9567-91728ccdaead}
85 | Configuration
86 |
87 |
88 | {c3d28c73-4db9-430a-8673-93b97c664915}
89 | Contracts
90 |
91 |
92 |
93 |
94 |
95 |
96 | This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
97 |
98 |
99 |
100 |
107 |
--------------------------------------------------------------------------------
/TestSubscriber/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Autofac;
3 | using Configuration;
4 | using MassTransit;
5 | using MassTransit.Saga;
6 |
7 | namespace OrderSaga
8 | {
9 | internal class Program
10 | {
11 | private static void Main(string[] args)
12 | {
13 | using (
14 | BusInitializer.CreateBus("OrderSaga",
15 | x => x.Subscribe(c => c.Saga(new InMemorySagaRepository()).Permanent())))
16 | {
17 | Console.WriteLine("Waiting..");
18 | Console.ReadKey();
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/TestSubscriber/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("TestSubscriber")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("TestSubscriber")]
13 | [assembly: AssemblyCopyright("Copyright © 2014")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("a64f81a7-4c7d-499c-ab23-986710494f4b")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/TestSubscriber/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------