Skip to content

Commit

Permalink
Starting interfaces for conventional messaging topology
Browse files Browse the repository at this point in the history
  • Loading branch information
arobson committed May 29, 2011
1 parent b996670 commit fe5a3d6
Show file tree
Hide file tree
Showing 33 changed files with 845 additions and 120 deletions.
1 change: 1 addition & 0 deletions demo/Minion/Minion.Host/Host.cs
Expand Up @@ -13,6 +13,7 @@ public void Start()
{
"Host has started."
.ToInfo<IMinion>();

Bus.AddLocalChannel();
Bus.AddRabbitChannel(x => x.Direct("Host").AutoDelete());
Bus.AddRabbitQueue(x => x.AutoDelete().QueueName("Host").ExchangeName("Host").StartSubscription().NoAck());
Expand Down
2 changes: 1 addition & 1 deletion demo/Minion/Minion.Hosted/Hosted.cs
Expand Up @@ -15,7 +15,7 @@ public void Start()
"Hosted Daemon has been summoned!"
.ToInfo<IMinion>();
Bus.AddLocalChannel();
Bus.AddRabbitChannel(x => x.Direct("Host").AutoDelete());
Bus.AddRabbitChannel(x => x.Direct("Host").AutoDelete().Durable().PersistentDelivery());

Bus.AddRabbitChannel(x => x.Direct("Hosted").AutoDelete());
Bus.AddRabbitQueue(x => x.AutoDelete().QueueName("Hosted").ExchangeName("Hosted").StartSubscription().NoAck());
Expand Down
13 changes: 7 additions & 6 deletions demo/Minion/Minion.Hosted/Initializer.cs
Expand Up @@ -9,12 +9,13 @@ public class Initializer : IMinion
{
public void Initialize()
{
DaemonAssimilation.RunDaemon( Assimilate
.Initialize()
.Daemon(x => x.Arguments(new string[]{}))
.AddConsoleLogger<IMinion>(l => l.Info().MessageLayout(m => m.Message().Newline()))
.AddColorConsoleLogger<IDaemon>( l => l.Info().MessageLayout( m => m.Message().Newline() ).DefineColor().Text.IsWhite().BackGround.IsRed().ForAllOutput() )
.Rabbit(x => x.AddBroker(r => r.Defaults())) );
Assimilate
.Initialize()
.Daemon(x => x.Arguments(new string[]{}))
.AddConsoleLogger<IMinion>(l => l.Info().MessageLayout(m => m.Message().Newline()))
.AddColorConsoleLogger<IDaemon>( l => l.Info().MessageLayout( m => m.Message().Newline() ).DefineColor().Text.IsWhite().BackGround.IsRed().ForAllOutput() )
.Rabbit(x => x.AddBroker(r => r.Defaults()))
.RunDaemon();
}
}
}
57 changes: 57 additions & 0 deletions demo/Rabbit/ConsoleApplication1/ConsoleApplication1.csproj
@@ -0,0 +1,57 @@
<?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)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{B1DC2475-6B09-4039-A984-A1DD5385125F}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ConsoleApplication1</RootNamespace>
<AssemblyName>ConsoleApplication1</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<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|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</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>
14 changes: 14 additions & 0 deletions demo/Rabbit/ConsoleApplication1/Program.cs
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
}
}
}
36 changes: 36 additions & 0 deletions demo/Rabbit/ConsoleApplication1/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("ConsoleApplication1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("ConsoleApplication1")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[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("02d7cf4c-b400-4239-821c-0b90bd8ede72")]

// 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")]
10 changes: 10 additions & 0 deletions demo/Rabbit/ping-pong/ping-pong.sln
Expand Up @@ -6,13 +6,23 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D558BC99-6F9A-4A1A-81FA-C0C24CAC25E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D558BC99-6F9A-4A1A-81FA-C0C24CAC25E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D558BC99-6F9A-4A1A-81FA-C0C24CAC25E6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D558BC99-6F9A-4A1A-81FA-C0C24CAC25E6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D558BC99-6F9A-4A1A-81FA-C0C24CAC25E6}.Debug|x86.ActiveCfg = Debug|Any CPU
{D558BC99-6F9A-4A1A-81FA-C0C24CAC25E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D558BC99-6F9A-4A1A-81FA-C0C24CAC25E6}.Release|Any CPU.Build.0 = Release|Any CPU
{D558BC99-6F9A-4A1A-81FA-C0C24CAC25E6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D558BC99-6F9A-4A1A-81FA-C0C24CAC25E6}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D558BC99-6F9A-4A1A-81FA-C0C24CAC25E6}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
67 changes: 67 additions & 0 deletions demo/Rabbit/ping/Program.cs
@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using pingpong.messages;
using Symbiote.Core;
using Symbiote.Core.Extensions;
using Symbiote.Daemon;
using Symbiote.Messaging;
using Symbiote.Rabbit;
using Symbiote.Log4Net;

namespace ping
{
class Program
{
static void Main(string[] args)
{
Assimilate
.Initialize()
.Rabbit( x => x.AddBroker( b => b.Defaults() ) )
.AddConsoleLogger<PingService>( x => x.Debug().MessageLayout( m => m.Message().Newline() ) )
.Daemon( x => x.Name( "ping" ) )
.RunDaemon();
}
}

public class PingService : IDaemon
{
public IBus Bus { get; set; }

public void Start()
{
Bus.AddRabbitChannel( x => x.Direct( "ping" ) );
Bus.AddRabbitQueue( x => x.ExchangeName( "ping" ).QueueName( "ping" ).NoAck() );


Enumerable.Range( 0, 100 ).ForEach( x =>
{
Bus.Request<Ping, Pong>( "ping", new Ping() ).OnValue( p =>
"Received pong!".ToInfo<PingService>()
);
Thread.Sleep( 1000 );
} );
}

public void Stop()
{

}

public PingService( IBus bus )
{
Bus = bus;
}
}

public class PongHandler : IHandle<Pong>
{
public Action<IEnvelope> Handle( Pong message )
{
"Received Pong!".ToInfo<PingService>();
return x => x.Acknowledge();
}
}
}
36 changes: 36 additions & 0 deletions demo/Rabbit/ping/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("ping")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("ping")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[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("08a6524b-412d-4e0e-970c-cc01dc7e58a8")]

// 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")]
3 changes: 3 additions & 0 deletions demo/Rabbit/ping/app.config
@@ -0,0 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
91 changes: 91 additions & 0 deletions demo/Rabbit/ping/ping.csproj
@@ -0,0 +1,91 @@
<?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)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F346B1C1-3007-4659-A292-BEAE0DC2601D}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ping</RootNamespace>
<AssemblyName>ping</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<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|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="CommandLine">
<HintPath>..\..\..\bin\debug\CommandLine.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\..\..\bin\debug\log4net.dll</HintPath>
</Reference>
<Reference Include="RabbitMQ.Client">
<HintPath>..\..\..\bin\debug\RabbitMQ.Client.dll</HintPath>
</Reference>
<Reference Include="Symbiote.Core">
<HintPath>..\..\..\bin\debug\Symbiote.Core.dll</HintPath>
</Reference>
<Reference Include="Symbiote.Daemon">
<HintPath>..\..\..\bin\debug\Symbiote.Daemon.dll</HintPath>
</Reference>
<Reference Include="Symbiote.Log4Net">
<HintPath>..\..\..\bin\debug\Symbiote.Log4Net.dll</HintPath>
</Reference>
<Reference Include="Symbiote.Messaging">
<HintPath>..\..\..\bin\debug\Symbiote.Messaging.dll</HintPath>
</Reference>
<Reference Include="Symbiote.Rabbit">
<HintPath>..\..\..\bin\debug\Symbiote.Rabbit.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\pingpong.messages\pingpong.messages.csproj">
<Project>{EA3F4A1C-3248-4C71-A9F4-7CFF3ABF778A}</Project>
<Name>pingpong.messages</Name>
</ProjectReference>
</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>

0 comments on commit fe5a3d6

Please sign in to comment.