Browse files

Latest Magnum and Topshelf Integrated and TESTED

  • Loading branch information...
1 parent 0404e1b commit b48c6ab53491416f395cddcd7b9827ca6497ba4e @phatboyg phatboyg committed Jan 28, 2010
View
48 .gitignore
@@ -1,23 +1,25 @@
-build_output/*
-code_drop/*
-
-**/*.suo
-**/*.user
-**/*.sln*
-bin
-obj
-_ReSharper*
-
-*.csproj.user
-*.resharper.user
-*.resharper
-*.cache
-*~
-*.swp
-*.bak
-*.orig
-
-TestResult.xml
-submit.xml
-src/tests/*
-SolutionVersion.cs
+build_output/*
+code_drop/*
+*.suo
+*.user
+
+src/logs/*
+
+**/*.sln*
+bin
+obj
+_ReSharper*
+
+*.csproj.user
+*.resharper.user
+*.resharper
+*.cache
+*~
+*.swp
+*.bak
+*.orig
+
+TestResult.xml
+submit.xml
+src/tests/*
+SolutionVersion.cs
View
18 lib/Magnum.Infrastructure.XML
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<doc>
+ <assembly>
+ <name>Magnum.Infrastructure</name>
+ </assembly>
+ <members>
+ <member name="T:Magnum.Infrastructure.StateMachine.StateMachineUserType">
+ <summary>
+ An NHibernate user type for persisting state machines current state
+ </summary>
+ </member>
+ <member name="T:Magnum.Infrastructure.UriUserType">
+ <summary>
+ An NHibernate user type for storing a Uri
+ </summary>
+ </member>
+ </members>
+</doc>
View
BIN lib/Magnum.Infrastructure.dll
Binary file not shown.
View
BIN lib/Magnum.Infrastructure.pdb
Binary file not shown.
View
11,998 lib/Magnum.XML
11,998 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
BIN lib/Magnum.dll
Binary file not shown.
View
BIN lib/Magnum.pdb
Binary file not shown.
View
BIN lib/Topshelf/Topshelf.dll
Binary file not shown.
View
15 src/MassTransit.RuntimeServices/HealthServiceRegistry.cs
@@ -21,7 +21,6 @@ namespace MassTransit.RuntimeServices
using Saga;
using Services.HealthMonitoring;
using StructureMap;
- using StructureMap.Attributes;
using StructureMapIntegration;
public class HealthServiceRegistry :
@@ -35,12 +34,12 @@ public HealthServiceRegistry(IContainer container)
var configuration = container.GetInstance<IConfiguration>();
- ForRequestedType<ISessionFactory>()
- .CacheBy(InstanceScope.Singleton)
- .TheDefault.Is.ConstructedBy(context => CreateSessionFactory());
+ For<ISessionFactory>()
+ .Singleton()
+ .Use(context => CreateSessionFactory());
- ForRequestedType(typeof (ISagaRepository<>))
- .AddConcreteType(typeof (NHibernateSagaRepositoryForContainers<>));
+ For(typeof (ISagaRepository<>))
+ .Add(typeof (NHibernateSagaRepositoryForContainers<>));
RegisterControlBus(configuration.HealthServiceControlUri, x => { });
@@ -63,9 +62,9 @@ private static ISessionFactory CreateSessionFactory()
private static void BuildSchema(NHibernate.Cfg.Configuration config)
{
- new SchemaUpdate(config).Execute(false, true);
+ new SchemaUpdate(config).Execute(false, true);
- var schemaFile = Path.Combine(Path.GetDirectoryName(typeof (HealthService).Assembly.Location), typeof (HealthService).Name + ".sql");
+ string schemaFile = Path.Combine(Path.GetDirectoryName(typeof (HealthService).Assembly.Location), typeof (HealthService).Name + ".sql");
new SchemaExport(config).SetOutputFile(schemaFile).Execute(false, false, false);
}
View
313 src/MassTransit.RuntimeServices/MassTransit.RuntimeServices.csproj
@@ -1,159 +1,156 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.30729</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{8AFA8821-2851-4134-8E0A-F9E7E10D28D9}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>MassTransit.RuntimeServices</RootNamespace>
- <AssemblyName>MassTransit.RuntimeServices</AssemblyName>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>..\..\bin\RuntimeServices\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <NoWarn>3009,3001</NoWarn>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>..\..\bin\RuntimeServices\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <NoWarn>3009,3001</NoWarn>
- <DocumentationFile>
- </DocumentationFile>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Castle.Core, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\FluentNHibernate\Castle.Core.dll</HintPath>
- </Reference>
- <Reference Include="Castle.DynamicProxy2, Version=2.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\FluentNHibernate\Castle.DynamicProxy2.dll</HintPath>
- </Reference>
- <Reference Include="FluentNHibernate, Version=0.1.0.483, Culture=neutral, PublicKeyToken=8aa435e3cb308880, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\FluentNHibernate\FluentNHibernate.dll</HintPath>
- </Reference>
- <Reference Include="Iesi.Collections, Version=1.0.0.3, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\FluentNHibernate\Iesi.Collections.dll</HintPath>
- </Reference>
- <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\log4net.dll</HintPath>
- </Reference>
- <Reference Include="Magnum, Version=0.1.0.296, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\Magnum.dll</HintPath>
- </Reference>
- <Reference Include="Magnum.Infrastructure, Version=0.1.0.296, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\Magnum.Infrastructure.dll</HintPath>
- </Reference>
- <Reference Include="Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\Microsoft.Practices.ServiceLocation.dll</HintPath>
- </Reference>
- <Reference Include="NHibernate, Version=2.0.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\FluentNHibernate\NHibernate.dll</HintPath>
- </Reference>
- <Reference Include="NHibernate.ByteCode.Castle, Version=2.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\FluentNHibernate\NHibernate.ByteCode.Castle.dll</HintPath>
- </Reference>
- <Reference Include="NHibernate.Linq, Version=1.0.0.0, Culture=neutral, PublicKeyToken=444cf6a87fdab271, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\FluentNHibernate\NHibernate.Linq.dll</HintPath>
- </Reference>
- <Reference Include="StructureMap, Version=2.5.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\StructureMap\StructureMap.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.configuration" />
- <Reference Include="System.Core">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Web.Extensions">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Windows.Forms" />
- <Reference Include="System.Xml.Linq">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- <Reference Include="Topshelf, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\lib\Topshelf\Topshelf.dll</HintPath>
- </Reference>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="..\SolutionVersion.cs">
- <Link>SolutionVersion.cs</Link>
- </Compile>
- <Compile Include="Configuration.cs" />
- <Compile Include="HealthServiceRegistry.cs" />
- <Compile Include="IConfiguration.cs" />
- <Compile Include="Model\HealthSagaMap.cs" />
- <Compile Include="Model\TimeoutSagaMap.cs" />
- <Compile Include="Model\SubscriptionClientSagaMap.cs" />
- <Compile Include="Model\SubscriptionSagaMap.cs" />
- <Compile Include="Program.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="SubscriptionServiceRegistry.cs" />
- <Compile Include="TimeoutServiceRegistry.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Containers\MassTransit.StructureMapIntegration\MassTransit.StructureMapIntegration.csproj">
- <Project>{F5E67502-2B30-484C-88C3-97710291F5AA}</Project>
- <Name>MassTransit.StructureMapIntegration</Name>
- </ProjectReference>
- <ProjectReference Include="..\MassTransit.Infrastructure\MassTransit.Infrastructure.csproj">
- <Project>{073A90FD-9A3E-4704-B3B5-6D8A9F4B442E}</Project>
- <Name>MassTransit.Infrastructure</Name>
- </ProjectReference>
- <ProjectReference Include="..\MassTransit\MassTransit.csproj">
- <Project>{6EFD69FC-CBCC-4F85-AEE0-EFBA73F4D273}</Project>
- <Name>MassTransit</Name>
- </ProjectReference>
- <ProjectReference Include="..\Transports\MassTransit.Transports.Msmq\MassTransit.Transports.Msmq.csproj">
- <Project>{6F90867C-E092-4EDC-B3DE-600D39DF0335}</Project>
- <Name>MassTransit.Transports.Msmq</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="App.config" />
- <None Include="SetupSQLServer.sql" />
- </ItemGroup>
- <ItemGroup>
- <Content Include="MassTransit.RuntimeServices.log4net.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- <Content Include="MassTransit.RuntimeServices.sdf">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{8AFA8821-2851-4134-8E0A-F9E7E10D28D9}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>MassTransit.RuntimeServices</RootNamespace>
+ <AssemblyName>MassTransit.RuntimeServices</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\bin\RuntimeServices\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <NoWarn>3009,3001</NoWarn>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>..\..\bin\RuntimeServices\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <NoWarn>3009,3001</NoWarn>
+ <DocumentationFile>
+ </DocumentationFile>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Castle.Core, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\FluentNHibernate\Castle.Core.dll</HintPath>
+ </Reference>
+ <Reference Include="Castle.DynamicProxy2, Version=2.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\FluentNHibernate\Castle.DynamicProxy2.dll</HintPath>
+ </Reference>
+ <Reference Include="FluentNHibernate, Version=0.1.0.483, Culture=neutral, PublicKeyToken=8aa435e3cb308880, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\FluentNHibernate\FluentNHibernate.dll</HintPath>
+ </Reference>
+ <Reference Include="Iesi.Collections, Version=1.0.0.3, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\FluentNHibernate\Iesi.Collections.dll</HintPath>
+ </Reference>
+ <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\log4net.dll</HintPath>
+ </Reference>
+ <Reference Include="Magnum, Version=0.1.0.296, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\Magnum.dll</HintPath>
+ </Reference>
+ <Reference Include="Magnum.Infrastructure, Version=0.1.0.296, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\Magnum.Infrastructure.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\Microsoft.Practices.ServiceLocation.dll</HintPath>
+ </Reference>
+ <Reference Include="NHibernate, Version=2.0.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\FluentNHibernate\NHibernate.dll</HintPath>
+ </Reference>
+ <Reference Include="NHibernate.ByteCode.Castle, Version=2.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\FluentNHibernate\NHibernate.ByteCode.Castle.dll</HintPath>
+ </Reference>
+ <Reference Include="NHibernate.Linq, Version=1.0.0.0, Culture=neutral, PublicKeyToken=444cf6a87fdab271, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\FluentNHibernate\NHibernate.Linq.dll</HintPath>
+ </Reference>
+ <Reference Include="StructureMap, Version=2.5.3.0, Culture=neutral, PublicKeyToken=e60ad81abae3c223, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\StructureMap\StructureMap.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.configuration" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Web.Extensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ <Reference Include="Topshelf, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\lib\Topshelf\Topshelf.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="..\SolutionVersion.cs">
+ <Link>SolutionVersion.cs</Link>
+ </Compile>
+ <Compile Include="Configuration.cs" />
+ <Compile Include="HealthServiceRegistry.cs" />
+ <Compile Include="IConfiguration.cs" />
+ <Compile Include="Model\HealthSagaMap.cs" />
+ <Compile Include="Model\TimeoutSagaMap.cs" />
+ <Compile Include="Model\SubscriptionClientSagaMap.cs" />
+ <Compile Include="Model\SubscriptionSagaMap.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="SubscriptionServiceRegistry.cs" />
+ <Compile Include="TimeoutServiceRegistry.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Containers\MassTransit.StructureMapIntegration\MassTransit.StructureMapIntegration.csproj">
+ <Project>{F5E67502-2B30-484C-88C3-97710291F5AA}</Project>
+ <Name>MassTransit.StructureMapIntegration</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\MassTransit.Infrastructure\MassTransit.Infrastructure.csproj">
+ <Project>{073A90FD-9A3E-4704-B3B5-6D8A9F4B442E}</Project>
+ <Name>MassTransit.Infrastructure</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\MassTransit\MassTransit.csproj">
+ <Project>{6EFD69FC-CBCC-4F85-AEE0-EFBA73F4D273}</Project>
+ <Name>MassTransit</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Transports\MassTransit.Transports.Msmq\MassTransit.Transports.Msmq.csproj">
+ <Project>{6F90867C-E092-4EDC-B3DE-600D39DF0335}</Project>
+ <Name>MassTransit.Transports.Msmq</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ <None Include="SetupSQLServer.sql" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="MassTransit.RuntimeServices.log4net.xml">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="MassTransit.RuntimeServices.sdf">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
</Project>
View
205 src/MassTransit.RuntimeServices/Program.cs
@@ -1,100 +1,107 @@
-// Copyright 2007-2008 The Apache Software Foundation.
-//
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
-// this file except in compliance with the License. You may obtain a copy of the
-// License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software distributed
-// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
-// CONDITIONS OF ANY KIND, either express or implied. See the License for the
-// specific language governing permissions and limitations under the License.
-using Topshelf.Configuration.Dsl;
-
-namespace MassTransit.RuntimeServices
-{
- using System;
- using System.IO;
- using log4net;
- using log4net.Config;
- using Magnum.Reflection;
- using Services.HealthMonitoring;
- using Services.Subscriptions.Server;
- using Services.Timeout;
- using StructureMap;
- using StructureMap.Configuration.DSL;
- using StructureMapIntegration;
- using Topshelf;
- using Topshelf.Configuration;
- using Transports.Msmq;
-
- internal class Program
- {
- private static readonly ILog _log = LogManager.GetLogger(typeof (Program));
-
- private static void Main(string[] args)
- {
- BootstrapLogger();
-
- MsmqEndpointConfigurator.Defaults(x => { x.CreateMissingQueues = true; });
-
- ObjectFactory.Initialize(x => { x.For<IConfiguration>().Use<Configuration>(); });
-
- var serviceConfiguration = ObjectFactory.GetInstance<IConfiguration>();
-
- RunConfiguration configuration = RunnerConfigurator.New(config =>
- {
- config.SetServiceName(typeof (Program).Namespace);
- config.SetDisplayName(typeof (Program).Namespace);
- config.SetDescription("MassTransit Runtime Services (Subscription, Timeout, Health Monitoring)");
-
- config.RunAsLocalSystem();
-
- config.DependencyOnMsmq();
- config.DependencyOnMsSql();
-
- if (serviceConfiguration.SubscriptionServiceEnabled)
- {
- config.ConfigureService<SubscriptionService>(service => { ConfigureService<SubscriptionService, SubscriptionServiceRegistry>(service, start => start.Start(), stop => stop.Stop()); });
- }
-
- if (serviceConfiguration.HealthServiceEnabled)
- {
- config.ConfigureService<HealthService>(service => { ConfigureService<HealthService, HealthServiceRegistry>(service, start => start.Start(), stop => stop.Stop()); });
- }
-
- if (serviceConfiguration.TimeoutServiceEnabled)
- {
- config.ConfigureService<TimeoutService>(service => { ConfigureService<TimeoutService, TimeoutServiceRegistry>(service, start => start.Start(), stop => stop.Stop()); });
- }
-
- config.AfterStoppingTheHost(x => { _log.Info("MassTransit Runtime Services are exiting..."); });
- });
- Runner.Host(configuration, args);
- }
-
- private static void BootstrapLogger()
- {
- string configFileName = AppDomain.CurrentDomain.BaseDirectory + Path.DirectorySeparatorChar + typeof (Program).Namespace + ".log4net.xml";
-
- XmlConfigurator.ConfigureAndWatch(new FileInfo(configFileName));
-
- _log.Info("Loading " + typeof (Program).Namespace + " Services...");
- }
-
- private static void ConfigureService<TService, TRegistry>(IServiceConfigurator<TService> service, Action<TService> start, Action<TService> stop)
- where TRegistry : Registry
- {
- var registry = FastActivator<TRegistry>.Create(ObjectFactory.Container);
- ObjectFactory.Configure(cfg =>
- {
- cfg.For<IConfiguration>().Singleton().Use<Configuration>();
- cfg.AddRegistry(registry);
- });
- service.HowToBuildService(builder => ObjectFactory.GetInstance<TService>());
- service.WhenStarted(start);
- service.WhenStopped(stop);
- }
- }
+// Copyright 2007-2008 The Apache Software Foundation.
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+// this file except in compliance with the License. You may obtain a copy of the
+// License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software distributed
+// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+// CONDITIONS OF ANY KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations under the License.
+namespace MassTransit.RuntimeServices
+{
+ using System;
+ using System.IO;
+ using log4net;
+ using log4net.Config;
+ using Magnum.Reflection;
+ using Services.HealthMonitoring;
+ using Services.Subscriptions.Server;
+ using Services.Timeout;
+ using StructureMap;
+ using StructureMap.Configuration.DSL;
+ using Topshelf;
+ using Topshelf.Configuration;
+ using Topshelf.Configuration.Dsl;
+ using Transports.Msmq;
+
+ internal class Program
+ {
+ private static readonly ILog _log = LogManager.GetLogger(typeof (Program));
+
+ private static void Main(string[] args)
+ {
+ BootstrapLogger();
+
+ MsmqEndpointConfigurator.Defaults(x => { x.CreateMissingQueues = true; });
+
+ ObjectFactory.Initialize(x => { x.For<IConfiguration>().Use<Configuration>(); });
+
+ var serviceConfiguration = ObjectFactory.GetInstance<IConfiguration>();
+
+ RunConfiguration configuration = RunnerConfigurator.New(config =>
+ {
+ config.SetServiceName(typeof (Program).Namespace);
+ config.SetDisplayName(typeof (Program).Namespace);
+ config.SetDescription("MassTransit Runtime Services (Subscription, Timeout, Health Monitoring)");
+
+ config.RunAsLocalSystem();
+
+ config.DependencyOnMsmq();
+ config.DependencyOnMsSql();
+
+ if (serviceConfiguration.SubscriptionServiceEnabled)
+ {
+ config.ConfigureService<SubscriptionService>(service => { ConfigureService<SubscriptionService, SubscriptionServiceRegistry>(service, start => start.Start(), stop => stop.Stop()); });
+ }
+
+ if (serviceConfiguration.HealthServiceEnabled)
+ {
+ config.ConfigureService<HealthService>(service => { ConfigureService<HealthService, HealthServiceRegistry>(service, start => start.Start(), stop => stop.Stop()); });
+ }
+
+ if (serviceConfiguration.TimeoutServiceEnabled)
+ {
+ config.ConfigureService<TimeoutService>(service => { ConfigureService<TimeoutService, TimeoutServiceRegistry>(service, start => start.Start(), stop => stop.Stop()); });
+ }
+
+ config.AfterStoppingTheHost(x => { _log.Info("MassTransit Runtime Services are exiting..."); });
+ });
+ Runner.Host(configuration, args);
+ }
+
+ private static void BootstrapLogger()
+ {
+ string configFileName = AppDomain.CurrentDomain.BaseDirectory + Path.DirectorySeparatorChar + typeof (Program).Namespace + ".log4net.xml";
+
+ XmlConfigurator.ConfigureAndWatch(new FileInfo(configFileName));
+
+ _log.Info("Loading " + typeof (Program).Namespace + " Services...");
+ }
+
+ private static void ConfigureService<TService, TRegistry>(IServiceConfigurator<TService> service, Action<TService> start, Action<TService> stop)
+ where TRegistry : Registry
+ {
+ var container = new Container(x =>
+ {
+ x.For<IConfiguration>()
+ .Singleton()
+ .Add<Configuration>();
+
+ x.For<TService>()
+ .Singleton()
+ .Use<TService>();
+ });
+
+ TRegistry registry = FastActivator<TRegistry>.Create(container);
+
+ container.Configure(x => x.AddRegistry(registry));
+
+ service.HowToBuildService(builder => container.GetInstance<TService>());
+ service.WhenStarted(start);
+ service.WhenStopped(stop);
+ }
+ }
}
View
26 src/MassTransit.RuntimeServices/SubscriptionServiceRegistry.cs
@@ -22,29 +22,25 @@ namespace MassTransit.RuntimeServices
using Saga;
using Services.Subscriptions.Server;
using StructureMap;
- using StructureMap.Attributes;
using StructureMapIntegration;
- public class SubscriptionServiceRegistry :
+ public class SubscriptionServiceRegistry :
MassTransitRegistryBase
{
public SubscriptionServiceRegistry(IContainer container)
{
var configuration = container.GetInstance<IConfiguration>();
- ForRequestedType<ISessionFactory>()
- .CacheBy(InstanceScope.Singleton)
- .TheDefault.Is.ConstructedBy(context => CreateSessionFactory());
+ For<ISessionFactory>()
+ .Singleton()
+ .Use(context => CreateSessionFactory());
- ForRequestedType(typeof (ISagaRepository<>))
- .AddConcreteType(typeof (NHibernateSagaRepositoryForContainers<>));
- ForRequestedType<ISubscriptionRepository>()
- .AddConcreteType<PersistantSubscriptionRepository>();
+ For(typeof (ISagaRepository<>))
+ .Add(typeof (NHibernateSagaRepositoryForContainers<>));
+ For<ISubscriptionRepository>()
+ .Add<PersistantSubscriptionRepository>();
- RegisterServiceBus(configuration.SubscriptionServiceUri, x =>
- {
- x.SetConcurrentConsumerLimit(1);
- });
+ RegisterServiceBus(configuration.SubscriptionServiceUri, x => { x.SetConcurrentConsumerLimit(1); });
}
private static ISessionFactory CreateSessionFactory()
@@ -61,9 +57,9 @@ private static ISessionFactory CreateSessionFactory()
private static void BuildSchema(NHibernate.Cfg.Configuration config)
{
- new SchemaUpdate(config).Execute(false, true);
+ new SchemaUpdate(config).Execute(false, true);
- var schemaFile = Path.Combine(Path.GetDirectoryName(typeof(SubscriptionService).Assembly.Location), typeof(SubscriptionService).Name + ".sql");
+ string schemaFile = Path.Combine(Path.GetDirectoryName(typeof (SubscriptionService).Assembly.Location), typeof (SubscriptionService).Name + ".sql");
new SchemaExport(config).SetOutputFile(schemaFile).Execute(false, false, false);
}
View
7 src/MassTransit.RuntimeServices/TimeoutServiceRegistry.cs
@@ -22,10 +22,9 @@ namespace MassTransit.RuntimeServices
using Services.HealthMonitoring.Configuration;
using Services.Timeout;
using StructureMap;
- using StructureMap.Attributes;
using StructureMapIntegration;
- public class TimeoutServiceRegistry :
+ public class TimeoutServiceRegistry :
MassTransitRegistryBase
{
private readonly IContainer _container;
@@ -63,9 +62,9 @@ private static ISessionFactory CreateSessionFactory()
private static void BuildSchema(NHibernate.Cfg.Configuration config)
{
- new SchemaUpdate(config).Execute(false, true);
+ new SchemaUpdate(config).Execute(false, true);
- var schemaFile = Path.Combine(Path.GetDirectoryName(typeof(TimeoutService).Assembly.Location), typeof(TimeoutService).Name + ".sql");
+ string schemaFile = Path.Combine(Path.GetDirectoryName(typeof (TimeoutService).Assembly.Location), typeof (TimeoutService).Name + ".sql");
new SchemaExport(config).SetOutputFile(schemaFile).Execute(false, false, false);
}
View
59 src/Samples/Starbucks/Starbucks.Barista/Program.cs
@@ -1,4 +1,16 @@
-namespace Starbucks.Barista
+// Copyright 2007-2008 The Apache Software Foundation.
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+// this file except in compliance with the License. You may obtain a copy of the
+// License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software distributed
+// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+// CONDITIONS OF ANY KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations under the License.
+namespace Starbucks.Barista
{
using System;
using System.Diagnostics;
@@ -10,9 +22,9 @@
using MassTransit.Saga;
using MassTransit.Transports.Msmq;
using MassTransit.WindsorIntegration;
- using Microsoft.Practices.ServiceLocation;
using Topshelf;
using Topshelf.Configuration;
+ using Topshelf.Configuration.Dsl;
internal static class Program
{
@@ -24,7 +36,7 @@ private static void Main(string[] args)
{
XmlConfigurator.Configure(new FileInfo("barista.log4net.xml"));
- var cfg = RunnerConfigurator.New(c =>
+ RunConfiguration cfg = RunnerConfigurator.New(c =>
{
c.SetServiceName("StarbucksBarista");
c.SetDisplayName("Starbucks Barista");
@@ -33,32 +45,37 @@ private static void Main(string[] args)
c.DependencyOnMsmq();
c.RunAsFromInteractive();
- c.ConfigureService<BaristaService>(typeof(BaristaService).Name, s =>
- {
- s.CreateServiceLocator(() =>
- {
- MsmqEndpointConfigurator.Defaults(x =>
- {
- x.CreateMissingQueues = true;
- });
-
- IWindsorContainer container = new DefaultMassTransitContainer("Starbucks.Barista.Castle.xml");
- container.AddComponent("sagaRepository", typeof(ISagaRepository<>), typeof(InMemorySagaRepository<>));
-
- container.AddComponent<DrinkPreparationSaga>();
- container.AddComponent<BaristaService>(typeof(BaristaService).Name);
+ MsmqEndpointConfigurator.Defaults(x => { x.CreateMissingQueues = true; });
- Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
+ IWindsorContainer container = BootstrapContainer();
- StateMachineInspector.Trace(new DrinkPreparationSaga(CombGuid.Generate()));
+ DisplayStateMachine();
- return ServiceLocator.Current;
- });
+ c.ConfigureService<BaristaService>(s =>
+ {
+ s.HowToBuildService(builder => container.Resolve<BaristaService>());
s.WhenStarted(o => o.Start());
s.WhenStopped(o => o.Stop());
});
});
Runner.Host(cfg, args);
}
+
+ private static void DisplayStateMachine()
+ {
+ Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
+
+ StateMachineInspector.Trace(new DrinkPreparationSaga(CombGuid.Generate()));
+ }
+
+ private static IWindsorContainer BootstrapContainer()
+ {
+ IWindsorContainer container = new DefaultMassTransitContainer("Starbucks.Barista.Castle.xml");
+ container.AddComponent("sagaRepository", typeof (ISagaRepository<>), typeof (InMemorySagaRepository<>));
+
+ container.AddComponent<DrinkPreparationSaga>();
+ container.AddComponent<BaristaService>(typeof (BaristaService).Name);
+ return container;
+ }
}
}
View
20 src/Samples/Starbucks/Starbucks.Barista/Starbucks.Barista.csproj
@@ -33,43 +33,37 @@
<ItemGroup>
<Reference Include="Castle.Core, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\Castle\Castle.Core.dll</HintPath>
+ <HintPath>..\..\..\..\lib\Castle\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="Castle.DynamicProxy2, Version=2.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\Castle\Castle.DynamicProxy2.dll</HintPath>
+ <HintPath>..\..\..\..\lib\Castle\Castle.DynamicProxy2.dll</HintPath>
</Reference>
<Reference Include="Castle.MicroKernel, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\Castle\Castle.MicroKernel.dll</HintPath>
+ <HintPath>..\..\..\..\lib\Castle\Castle.MicroKernel.dll</HintPath>
</Reference>
<Reference Include="Castle.Windsor, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\Castle\Castle.Windsor.dll</HintPath>
+ <HintPath>..\..\..\..\lib\Castle\Castle.Windsor.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\log4net.dll</HintPath>
+ <HintPath>..\..\..\..\lib\log4net.dll</HintPath>
</Reference>
<Reference Include="Magnum, Version=0.1.0.44, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\Magnum.dll</HintPath>
+ <HintPath>..\..\..\..\lib\Magnum.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\Microsoft.Practices.ServiceLocation.dll</HintPath>
+ <HintPath>..\..\..\..\lib\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Windows.Forms" />
- <Reference Include="System.Xml.Linq">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
- <Reference Include="System.Data.DataSetExtensions">
- <RequiredTargetFramework>3.5</RequiredTargetFramework>
- </Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Topshelf, Version=0.8.0.78, Culture=neutral, processorArchitecture=MSIL">
View
59 src/Samples/Starbucks/Starbucks.Cashier/Program.cs
@@ -1,4 +1,16 @@
-namespace Starbucks.Cashier
+// Copyright 2007-2008 The Apache Software Foundation.
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+// this file except in compliance with the License. You may obtain a copy of the
+// License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software distributed
+// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+// CONDITIONS OF ANY KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations under the License.
+namespace Starbucks.Cashier
{
using System;
using System.Diagnostics;
@@ -10,9 +22,9 @@
using MassTransit.Saga;
using MassTransit.Transports.Msmq;
using MassTransit.WindsorIntegration;
- using Microsoft.Practices.ServiceLocation;
using Topshelf;
using Topshelf.Configuration;
+ using Topshelf.Configuration.Dsl;
internal static class Program
{
@@ -24,7 +36,7 @@ private static void Main(string[] args)
{
XmlConfigurator.Configure(new FileInfo("cashier.log4net.xml"));
- var cfg = RunnerConfigurator.New(c =>
+ RunConfiguration cfg = RunnerConfigurator.New(c =>
{
c.SetServiceName("StarbucksCashier");
c.SetDisplayName("Starbucks Cashier");
@@ -33,32 +45,37 @@ private static void Main(string[] args)
c.RunAsLocalSystem();
c.DependencyOnMsmq();
- c.ConfigureService<CashierService>(typeof(CashierService).Name, s =>
- {
- s.CreateServiceLocator(() =>
- {
- MsmqEndpointConfigurator.Defaults(x =>
- {
- x.CreateMissingQueues = true;
- });
-
- IWindsorContainer container = new DefaultMassTransitContainer("Starbucks.Cashier.Castle.xml");
- container.AddComponent("sagaRepository", typeof(ISagaRepository<>), typeof(InMemorySagaRepository<>));
-
- container.AddComponent<CashierService>(typeof(CashierService).Name);
- container.AddComponent<CashierSaga>();
+ MsmqEndpointConfigurator.Defaults(x => { x.CreateMissingQueues = true; });
- Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
+ IWindsorContainer container = BootstrapContainer();
- StateMachineInspector.Trace(new CashierSaga(CombGuid.Generate()));
+ DisplayStateMachine();
- return ServiceLocator.Current;
- });
+ c.ConfigureService<CashierService>(s =>
+ {
+ s.HowToBuildService(builder => container.Resolve<CashierService>());
s.WhenStarted(o => o.Start());
s.WhenStopped(o => o.Stop());
});
});
Runner.Host(cfg, args);
}
+
+ private static void DisplayStateMachine()
+ {
+ Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
+
+ StateMachineInspector.Trace(new CashierSaga(CombGuid.Generate()));
+ }
+
+ private static IWindsorContainer BootstrapContainer()
+ {
+ IWindsorContainer container = new DefaultMassTransitContainer("Starbucks.Cashier.Castle.xml");
+ container.AddComponent("sagaRepository", typeof (ISagaRepository<>), typeof (InMemorySagaRepository<>));
+
+ container.AddComponent<CashierService>(typeof (CashierService).Name);
+ container.AddComponent<CashierSaga>();
+ return container;
+ }
}
}
View
14 src/Samples/Starbucks/Starbucks.Cashier/Starbucks.Cashier.csproj
@@ -33,31 +33,31 @@
<ItemGroup>
<Reference Include="Castle.Core, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\Castle\Castle.Core.dll</HintPath>
+ <HintPath>..\..\..\..\lib\Castle\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="Castle.DynamicProxy2, Version=2.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\Castle\Castle.DynamicProxy2.dll</HintPath>
+ <HintPath>..\..\..\..\lib\Castle\Castle.DynamicProxy2.dll</HintPath>
</Reference>
<Reference Include="Castle.MicroKernel, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\Castle\Castle.MicroKernel.dll</HintPath>
+ <HintPath>..\..\..\..\lib\Castle\Castle.MicroKernel.dll</HintPath>
</Reference>
<Reference Include="Castle.Windsor, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\Castle\Castle.Windsor.dll</HintPath>
+ <HintPath>..\..\..\..\lib\Castle\Castle.Windsor.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\log4net.dll</HintPath>
+ <HintPath>..\..\..\..\lib\log4net.dll</HintPath>
</Reference>
<Reference Include="Magnum, Version=0.1.0.44, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\Magnum.dll</HintPath>
+ <HintPath>..\..\..\..\lib\Magnum.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\Microsoft.Practices.ServiceLocation.dll</HintPath>
+ <HintPath>..\..\..\..\lib\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
View
51 src/Samples/Starbucks/Starbucks.Customer/Program.cs
@@ -1,12 +1,22 @@
-namespace Starbucks.Customer
+// Copyright 2007-2008 The Apache Software Foundation.
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+// this file except in compliance with the License. You may obtain a copy of the
+// License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software distributed
+// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+// CONDITIONS OF ANY KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations under the License.
+namespace Starbucks.Customer
{
using System;
+ using System.Windows.Forms;
using Castle.Windsor;
using MassTransit.Transports.Msmq;
using MassTransit.WindsorIntegration;
- using Microsoft.Practices.ServiceLocation;
- using Topshelf;
- using Topshelf.Configuration;
internal static class Program
{
@@ -16,31 +26,20 @@ internal static class Program
[STAThread]
private static void Main(string[] args)
{
- IRunConfiguration cfg = RunnerConfigurator.New(c =>
- {
- c.SetServiceName("StarbucksCustomer");
- c.SetDisplayName("Starbucks Customer");
- c.SetDescription(
- "a Mass Transit sample service for ordering coffee.");
+ MsmqEndpointConfigurator.Defaults(x => { x.CreateMissingQueues = true; });
- c.RunAsLocalSystem();
- c.DependencyOnMsmq();
- c.UseWinFormHost<OrderDrinkForm>();
+ BootstrapContainer();
- c.ConfigureService<CustomerService>(typeof(CustomerService).Name, s => s.CreateServiceLocator(() =>
- {
- MsmqEndpointConfigurator.Defaults(x =>
- {
- x.CreateMissingQueues = true;
- });
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new OrderDrinkForm());
+ }
- IWindsorContainer container = new DefaultMassTransitContainer("Starbucks.Customer.Castle.xml");
- container.AddComponent<CustomerService>(typeof(CustomerService).Name);
- container.AddComponent<OrderDrinkForm>();
- return ServiceLocator.Current;
- }));
- });
- Runner.Host(cfg, args);
+ private static void BootstrapContainer()
+ {
+ IWindsorContainer container = new DefaultMassTransitContainer("Starbucks.Customer.Castle.xml");
+ container.AddComponent<CustomerService>(typeof (CustomerService).Name);
+ container.AddComponent<OrderDrinkForm>();
}
}
}
View
14 src/Samples/Starbucks/Starbucks.Customer/Starbucks.Customer.csproj
@@ -33,31 +33,31 @@
<ItemGroup>
<Reference Include="Castle.Core, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\Castle\Castle.Core.dll</HintPath>
+ <HintPath>..\..\..\..\lib\Castle\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="Castle.DynamicProxy2, Version=2.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\Castle\Castle.DynamicProxy2.dll</HintPath>
+ <HintPath>..\..\..\..\lib\Castle\Castle.DynamicProxy2.dll</HintPath>
</Reference>
<Reference Include="Castle.MicroKernel, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\Castle\Castle.MicroKernel.dll</HintPath>
+ <HintPath>..\..\..\..\lib\Castle\Castle.MicroKernel.dll</HintPath>
</Reference>
<Reference Include="Castle.Windsor, Version=1.0.3.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\Castle\Castle.Windsor.dll</HintPath>
+ <HintPath>..\..\..\..\lib\Castle\Castle.Windsor.dll</HintPath>
</Reference>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\log4net.dll</HintPath>
+ <HintPath>..\..\..\..\lib\log4net.dll</HintPath>
</Reference>
<Reference Include="Magnum, Version=0.1.0.288, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\Magnum.dll</HintPath>
+ <HintPath>..\..\..\..\lib\Magnum.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\libs\Microsoft.Practices.ServiceLocation.dll</HintPath>
+ <HintPath>..\..\..\..\lib\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
View
324 src/Samples/Starbucks/Starbucks.resharper.xml
@@ -0,0 +1,324 @@
+<CodeStyleSettings>
+ <CSharp>
+ <FormatSettings>
+ <ALIGN_MULTILINE_ARGUMENT>False</ALIGN_MULTILINE_ARGUMENT>
+ <ALIGN_MULTILINE_ARRAY_AND_OBJECT_INITIALIZER>False</ALIGN_MULTILINE_ARRAY_AND_OBJECT_INITIALIZER>
+ <ALIGN_MULTILINE_EXTENDS_LIST>False</ALIGN_MULTILINE_EXTENDS_LIST>
+ <ALIGN_MULTLINE_TYPE_PARAMETER_CONSTRAINS>False</ALIGN_MULTLINE_TYPE_PARAMETER_CONSTRAINS>
+ <INDENT_ANONYMOUS_METHOD_BLOCK>False</INDENT_ANONYMOUS_METHOD_BLOCK>
+ <INDENT_EMBRACED_INITIALIZER_BLOCK>False</INDENT_EMBRACED_INITIALIZER_BLOCK>
+ <INDENT_SIZE>4</INDENT_SIZE>
+ <INSERT_TABS>True</INSERT_TABS>
+ <MODIFIERS_ORDER IsNull="False">
+ <Item>public</Item>
+ <Item>protected</Item>
+ <Item>internal</Item>
+ <Item>private</Item>
+ <Item>new</Item>
+ <Item>abstract</Item>
+ <Item>virtual</Item>
+ <Item>override</Item>
+ <Item>sealed</Item>
+ <Item>static</Item>
+ <Item>readonly</Item>
+ <Item>extern</Item>
+ <Item>unsafe</Item>
+ <Item>volatile</Item>
+ </MODIFIERS_ORDER>
+ <PLACE_CONSTRUCTOR_INITIALIZER_ON_SAME_LINE>False</PLACE_CONSTRUCTOR_INITIALIZER_ON_SAME_LINE>
+ <PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE>False</PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE>
+ <PLACE_TYPE_CONSTRAINTS_ON_SAME_LINE>False</PLACE_TYPE_CONSTRAINTS_ON_SAME_LINE>
+ <SPACE_BEFORE_ATTRIBUTE_COLON>True</SPACE_BEFORE_ATTRIBUTE_COLON>
+ <WRAP_BEFORE_FIRST_TYPE_PARAMETER_CONSTRAINT>True</WRAP_BEFORE_FIRST_TYPE_PARAMETER_CONSTRAINT>
+ <WRAP_EXTENDS_LIST_STYLE>CHOP_ALWAYS</WRAP_EXTENDS_LIST_STYLE>
+ <WRAP_LINES>False</WRAP_LINES>
+ <WRAP_MULTIPLE_TYPE_PARAMEER_CONSTRAINTS_STYLE>CHOP_ALWAYS</WRAP_MULTIPLE_TYPE_PARAMEER_CONSTRAINTS_STYLE>
+ </FormatSettings>
+ <UsingsSettings>
+ <AddImportsToDeepestScope>True</AddImportsToDeepestScope>
+ </UsingsSettings>
+ <Naming2>
+ <ExceptionName IsNull="False">
+ </ExceptionName>
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="TypesAndNamespaces" />
+ <PredefinedRule Inspect="True" Prefix="I" Suffix="" Style="AaBb" ElementKind="Interfaces" />
+ <PredefinedRule Inspect="True" Prefix="T" Suffix="" Style="AaBb" ElementKind="TypeParameters" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="MethodPropertyEvent" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Locals" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="LocalConstants" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Parameters" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PublicFields" />
+ <PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateInstanceFields" />
+ <PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateStaticFields" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Constants" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateConstants" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="StaticReadonly" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateStaticReadonly" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="EnumMember" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Other" />
+ </Naming2>
+ <CustomMemberReorderingPatterns><![CDATA[<?xml version="1.0" encoding="utf-8" ?>
+
+<!--
+I. Overall
+
+I.1 Each pattern can have <Match>....</Match> element. For the given type declaration, the pattern with the match, evaluated to 'true' with the largest weight, will be used
+I.2 Each pattern consists of the sequence of <Entry>...</Entry> elements. Type member declarations are distributed between entries
+I.3 If pattern has RemoveAllRegions="true" attribute, then all regions will be cleared prior to reordering. Otherwise, only auto-generated regions will be cleared
+I.4 The contents of each entry is sorted by given keys (First key is primary, next key is secondary, etc). Then the declarations are grouped and en-regioned by given property
+
+II. Available match operands
+
+Each operand may have Weight="..." attribute. This weight will be added to the match weight if the operand is evaluated to 'true'.
+The default weight is 1
+
+II.1 Boolean functions:
+II.1.1 <And>....</And>
+II.1.2 <Or>....</Or>
+II.1.3 <Not>....</Not>
+
+II.2 Operands
+II.2.1 <Kind Is="..."/>. Kinds are: class, struct, interface, enum, delegate, type, constructor, destructor, property, indexer, method, operator, field, constant, event, member
+II.2.2 <Name Is="..." [IgnoreCase="true/false"] />. The 'Is' attribute contains regular expression
+II.2.3 <HasAttribute CLRName="..." [Inherit="true/false"] />. The 'CLRName' attribute contains regular expression
+II.2.4 <Access Is="..."/>. The 'Is' values are: public, protected, internal, protected internal, private
+II.2.5 <Static/>
+II.2.6 <Abstract/>
+II.2.7 <Virtual/>
+II.2.8 <Override/>
+II.2.9 <Sealed/>
+II.2.10 <Readonly/>
+II.2.11 <ImplementsInterface CLRName="..."/>. The 'CLRName' attribute contains regular expression
+II.2.12 <HandlesEvent />
+-->
+
+<Patterns xmlns="urn:shemas-jetbrains-com:member-reordering-patterns">
+
+ <!--Do not reorder COM interfaces and structs marked by StructLayout attribute-->
+ <Pattern>
+ <Match>
+ <Or Weight="100">
+ <And>
+ <Kind Is="interface"/>
+ <HasAttribute CLRName="System.Runtime.InteropServices.InterfaceTypeAttribute"/>
+ </And>
+ <HasAttribute CLRName="System.Runtime.InteropServices.StructLayoutAttribute"/>
+ </Or>
+ </Match>
+ </Pattern>
+
+ <!--Special formatting of NUnit test fixture-->
+ <Pattern RemoveAllRegions="true">
+ <Match>
+ <And Weight="100">
+ <Kind Is="class"/>
+ <HasAttribute CLRName="NUnit.Framework.TestFixtureAttribute" Inherit="true"/>
+ </And>
+ </Match>
+
+ <!--Setup/Teardow-->
+ <Entry>
+ <Match>
+ <And>
+ <Kind Is="method"/>
+ <Or>
+ <HasAttribute CLRName="NUnit.Framework.SetUpAttribute" Inherit="true"/>
+ <HasAttribute CLRName="NUnit.Framework.TearDownAttribute" Inherit="true"/>
+ <HasAttribute CLRName="NUnit.Framework.FixtureSetUpAttribute" Inherit="true"/>
+ <HasAttribute CLRName="NUnit.Framework.FixtureTearDownAttribute" Inherit="true"/>
+ </Or>
+ </And>
+ </Match>
+ <Group />
+ </Entry>
+
+ <!--All other members-->
+ <Entry/>
+
+ <!--Test methods-->
+ <Entry>
+ <Match>
+ <And Weight="100">
+ <Kind Is="method"/>
+ <HasAttribute CLRName="NUnit.Framework.TestAttribute" Inherit="false"/>
+ </And>
+ </Match>
+ <Sort>
+ <Name/>
+ </Sort>
+ </Entry>
+ </Pattern>
+
+ <!--Default pattern-->
+ <Pattern>
+
+ <!--public delegate-->
+ <Entry>
+ <Match>
+ <And Weight="100">
+ <Access Is="public"/>
+ <Kind Is="delegate"/>
+ </And>
+ </Match>
+ <Sort>
+ <Name/>
+ </Sort>
+ <Group Region="Delegates"/>
+ </Entry>
+
+ <!--public enum-->
+ <Entry>
+ <Match>
+ <And Weight="100">
+ <Access Is="public"/>
+ <Kind Is="enum"/>
+ </And>
+ </Match>
+ <Sort>
+ <Name/>
+ </Sort>
+ <Group/>
+ </Entry>
+
+ <!--fields and constants-->
+ <Entry>
+ <Match>
+ <Or>
+ <Kind Is="constant"/>
+ <Kind Is="field"/>
+ </Or>
+ </Match>
+ <Sort>
+ <Kind Order="constant field"/>
+ <Static/>
+
+ <Readonly/>
+
+ <Name/>
+ </Sort>
+ </Entry>
+
+ <!--Constructors. Place static one first-->
+ <Entry>
+ <Match>
+ <Kind Is="constructor"/>
+ </Match>
+ <Sort>
+ <Static/>
+ </Sort>
+ </Entry>
+
+ <!--properties, indexers-->
+ <Entry>
+ <Match>
+ <Or>
+ <Kind Is="property"/>
+ <Kind Is="indexer"/>
+ </Or>
+ </Match>
+ <Sort>
+ <Static/>
+ <Access/>
+ </Sort>
+ </Entry>
+
+ <!--interface implementations-->
+ <Entry>
+ <Match>
+ <And Weight="100">
+ <Kind Is="member"/>
+ <ImplementsInterface/>
+ </And>
+ </Match>
+ <Sort>
+ <ImplementsInterface Immediate="true"/>
+ </Sort>
+ <Group/>
+ </Entry>
+
+ <!--all other members-->
+ <Entry>
+ <Match>
+ <Not>
+ <Static/>
+ </Not>
+ </Match>
+ <Sort>
+ <Access/>
+ </Sort>
+ </Entry>
+
+ <Entry>
+ <Match>
+ <Static/>
+ </Match>
+ <Sort>
+ <Access/>
+ </Sort>
+ </Entry>
+
+ <Entry/>
+
+ <!--nested types-->
+ <Entry>
+ <Match>
+ <Kind Is="type"/>
+ </Match>
+ <Sort>
+ <Name/>
+ </Sort>
+ <Group/>
+ </Entry>
+ </Pattern>
+
+</Patterns>
+]]></CustomMemberReorderingPatterns>
+ </CSharp>
+ <VB>
+ <FormatSettings>
+ <INDENT_SIZE>4</INDENT_SIZE>
+ </FormatSettings>
+ <ImportsSettings />
+ <Naming2 />
+ </VB>
+ <FileHeader><![CDATA[Copyright 2007-2008 The Apache Software Foundation.
+
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+this file except in compliance with the License. You may obtain a copy of the
+License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed
+under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, either express or implied. See the License for the
+specific language governing permissions and limitations under the License.
+]]></FileHeader>
+ <GenerateMemberBody />
+ <Naming2>
+ <ExceptionName IsNull="False">
+ </ExceptionName>
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="MethodPropertyEvent" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="TypesAndNamespaces" />
+ <PredefinedRule Inspect="True" Prefix="I" Suffix="" Style="AaBb" ElementKind="Interfaces">
+ <ExtraRule Prefix="" Suffix="" Style="AaBb" />
+ </PredefinedRule>
+ <PredefinedRule Inspect="True" Prefix="T" Suffix="" Style="AaBb" ElementKind="TypeParameters" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Locals" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="LocalConstants" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="aaBb" ElementKind="Parameters" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PublicFields" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Constants" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="StaticReadonly">
+ <ExtraRule Prefix="_" Suffix="" Style="aaBb" />
+ </PredefinedRule>
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="EnumMember" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="Other" />
+ <PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateInstanceFields" />
+ <PredefinedRule Inspect="True" Prefix="_" Suffix="" Style="aaBb" ElementKind="PrivateStaticFields" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateConstants" />
+ <PredefinedRule Inspect="True" Prefix="" Suffix="" Style="AaBb" ElementKind="PrivateStaticReadonly">
+ <ExtraRule Prefix="_" Suffix="" Style="aaBb" />
+ </PredefinedRule>
+ </Naming2>
+</CodeStyleSettings>
View
BIN src/Tools/Tools.suo
Binary file not shown.

0 comments on commit b48c6ab

Please sign in to comment.