Skip to content

Commit

Permalink
Added full duplex example
Browse files Browse the repository at this point in the history
  • Loading branch information
Goeleven, Yves committed Nov 2, 2010
1 parent ddabe13 commit eea5563
Show file tree
Hide file tree
Showing 23 changed files with 944 additions and 0 deletions.
74 changes: 74 additions & 0 deletions Samples/AzureFullDuplex/AzureFullDuplex.ccproj
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>1.0.0</ProductVersion>
<ProjectGuid>{adcfc6b6-8bf7-4d56-b6a4-f6d221111666}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AzureService</RootNamespace>
<AssemblyName>AzureService</AssemblyName>
<StartDevelopmentStorage>True</StartDevelopmentStorage>
<Name>AzureService</Name>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<!-- Items for the project -->
<ItemGroup>
<ServiceDefinition Include="ServiceDefinition.csdef" />
<ServiceConfiguration Include="ServiceConfiguration.cscfg" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="OrderService\OrderService.csproj">
<Name>OrderService</Name>
<Project>{84aca710-e5b3-4a46-b87a-7c12fb2527a8}</Project>
<Private>True</Private>
<RoleType>Worker</RoleType>
<RoleName>OrderService</RoleName>

</ProjectReference>
<ProjectReference Include="OrderWebSite\OrderWebSite.csproj">
<Name>OrderWebSite</Name>
<Project>{f3798c2c-41dc-407c-9ebe-3f10c1ca9a76}</Project>
<Private>True</Private>
<RoleType>Web</RoleType>
<RoleName>OrderWebSite</RoleName>
</ProjectReference>
</ItemGroup>
<!-- Import the target files for this project template -->
<PropertyGroup>
<CloudExtensionsDir Condition=" '$(CloudExtensionsDir)' == '' ">$(MSBuildExtensionsPath)\Microsoft\Cloud Service\1.0\Visual Studio 10.0\</CloudExtensionsDir>
</PropertyGroup>
<Import Project="$(CloudExtensionsDir)Microsoft.CloudService.targets" />



<!--PropertyGroup>
<BuildDependsOn>
$(BuildDependsOn);
UpdateEntryPoint;
</BuildDependsOn>
</PropertyGroup>
<Target Name="UpdateEntryPoint" >
<WriteLinesToFile File="$(ServiceOutputDirectory)\roles\OrderService\__entrypoint.txt" Lines="NServiceBus.Hosting.Azure.dll" Overwrite="true" />
</Target-->


</Project>
16 changes: 16 additions & 0 deletions Samples/AzureFullDuplex/AzureFullDuplex.ccproj.user
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<DeploymentBuildOnly>False</DeploymentBuildOnly>
<DeploymentAccountName>YvesGoeleven</DeploymentAccountName>
<DeploymentHostedService>yvesgoeleven</DeploymentHostedService>
<DeploymentHostedServiceLabel>Goeleven</DeploymentHostedServiceLabel>
<DeploymentSlot>Production</DeploymentSlot>
<DeploymentIncludeIntellitrace>False</DeploymentIncludeIntellitrace>
<DeploymentStorageService>goelevenplayground</DeploymentStorageService>
<DeploymentStorageServiceLabel>playground</DeploymentStorageServiceLabel>
<DeploymentLabel>AzureService - 26/09/2010 17:21:40</DeploymentLabel>
<DeploymentPromptBeforeDeleting>True</DeploymentPromptBeforeDeleting>
<DeploymentIsExpanded>False</DeploymentIsExpanded>
</PropertyGroup>
</Project>
38 changes: 38 additions & 0 deletions Samples/AzureFullDuplex/AzureFullDuplex.sln
@@ -0,0 +1,38 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{CC5FD16D-436D-48AD-A40C-5A424C6E3E79}") = "AzureFullDuplex", "AzureFullDuplex.ccproj", "{ADCFC6B6-8BF7-4D56-B6A4-F6D221111666}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrderWebSite", "OrderWebSite\OrderWebSite.csproj", "{F3798C2C-41DC-407C-9EBE-3F10C1CA9A76}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OrderService", "OrderService\OrderService.csproj", "{84ACA710-E5B3-4A46-B87A-7C12FB2527A8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyMessages", "MyMessages\MyMessages.csproj", "{3871CC9B-235F-4E60-98F7-FEF04DB1201B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{ADCFC6B6-8BF7-4D56-B6A4-F6D221111666}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ADCFC6B6-8BF7-4D56-B6A4-F6D221111666}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ADCFC6B6-8BF7-4D56-B6A4-F6D221111666}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ADCFC6B6-8BF7-4D56-B6A4-F6D221111666}.Release|Any CPU.Build.0 = Release|Any CPU
{F3798C2C-41DC-407C-9EBE-3F10C1CA9A76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F3798C2C-41DC-407C-9EBE-3F10C1CA9A76}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F3798C2C-41DC-407C-9EBE-3F10C1CA9A76}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F3798C2C-41DC-407C-9EBE-3F10C1CA9A76}.Release|Any CPU.Build.0 = Release|Any CPU
{84ACA710-E5B3-4A46-B87A-7C12FB2527A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{84ACA710-E5B3-4A46-B87A-7C12FB2527A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{84ACA710-E5B3-4A46-B87A-7C12FB2527A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{84ACA710-E5B3-4A46-B87A-7C12FB2527A8}.Release|Any CPU.Build.0 = Release|Any CPU
{3871CC9B-235F-4E60-98F7-FEF04DB1201B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3871CC9B-235F-4E60-98F7-FEF04DB1201B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3871CC9B-235F-4E60-98F7-FEF04DB1201B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3871CC9B-235F-4E60-98F7-FEF04DB1201B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Binary file added Samples/AzureFullDuplex/AzureFullDuplex.suo
Binary file not shown.
25 changes: 25 additions & 0 deletions Samples/AzureFullDuplex/OrderService/App.config
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core"/>
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core"/>
<section name="AzureQueueConfig" type="NServiceBus.Config.AzureQueueConfig, NServiceBus.Core"/>
</configSections>

<MsmqTransportConfig InputQueue="orderserviceinputqueue" ErrorQueue="error" NumberOfWorkerThreads="1" MaxRetries="5"/>

<AzureQueueConfig ConnectionString="UseDevelopmentStorage=true" />

<UnicastBusConfig>

</UnicastBusConfig>

<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<add name="AzureDiagnostics" type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</listeners>
</trace>
</system.diagnostics>
</configuration>

6 changes: 6 additions & 0 deletions Samples/AzureFullDuplex/OrderService/EndpointConfiguration.cs
@@ -0,0 +1,6 @@
using NServiceBus;

namespace OrderService
{
public class EndpointConfiguration : IConfigureThisEndpoint, AsA_Server { }
}
6 changes: 6 additions & 0 deletions Samples/AzureFullDuplex/OrderService/Host.cs
@@ -0,0 +1,6 @@
using NServiceBus.Hosting.Azure;

namespace OrderService
{
public class Host : RoleEntryPoint{}
}
@@ -0,0 +1,32 @@
using System.Threading;
using MyMessages;
using NServiceBus;
using Order=MyMessages.Order;

namespace OrderService.MessageHandlers
{
public class SubmitOrderMessageHandler : IHandleMessages<SubmitOrderRequest>
{
private readonly IBus bus;

public SubmitOrderMessageHandler(IBus bus)
{
this.bus = bus;
}

public void Handle(SubmitOrderRequest message)
{
var order = new Order
{
Id = message.Id,
Quantity = message.Quantity,
Status = OrderStatus.Pending
};

// Thread.Sleep(4000); //simulate processing

var response = bus.CreateInstance<SubmitOrderResponse>(x=>x.Order = order);
bus.Reply(response);
}
}
}
99 changes: 99 additions & 0 deletions Samples/AzureFullDuplex/OrderService/OrderService.csproj
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" 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>{84ACA710-E5B3-4A46-B87A-7C12FB2527A8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OrderService</RootNamespace>
<AssemblyName>OrderService</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<RoleType>Worker</RoleType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\binaries\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\binaries\Microsoft.WindowsAzure.Diagnostics.dll</HintPath>
</Reference>
<Reference Include="Microsoft.WindowsAzure.ServiceRuntime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\binaries\Microsoft.WindowsAzure.ServiceRuntime.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.WindowsAzure.StorageClient, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\binaries\Microsoft.WindowsAzure.StorageClient.dll</HintPath>
</Reference>
<Reference Include="NServiceBus, Version=2.1.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\binaries\NServiceBus.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.Core, Version=2.1.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\binaries\NServiceBus.Core.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.Hosting, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\build\hosting\NServiceBus.Hosting.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.Hosting.Azure, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\build\hosting\NServiceBus.Hosting.Azure.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core">
</Reference>
<Reference Include="System.Data" />
</ItemGroup>
<ItemGroup>
<Compile Include="EndpointConfiguration.cs" />
<Compile Include="MessageHandlers\SubmitOrderMessageHandler.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Host.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MyMessages\MyMessages.csproj">
<Project>{3871CC9B-235F-4E60-98F7-FEF04DB1201B}</Project>
<Name>MyMessages</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
</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>
36 changes: 36 additions & 0 deletions Samples/AzureFullDuplex/OrderService/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OrderService")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OrderService")]
[assembly: AssemblyCopyright("Copyright © 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6fdad954-96d7-4733-b5ee-41733ae4f018")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

0 comments on commit eea5563

Please sign in to comment.