Skip to content

Commit

Permalink
Merge branch '3.3.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomii committed Jan 15, 2013
2 parents f120d68 + 4819431 commit 9b607a2
Show file tree
Hide file tree
Showing 29 changed files with 193 additions and 294 deletions.
2 changes: 1 addition & 1 deletion default.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ task TestMain -depends CompileMain -description "Builds NServiceBus.dll, keeps t

task CompileCore -depends InitEnvironment -description "Builds NServiceBus.Core.dll and keeps the output in \binaries" {

$coreDirs = "unicastTransport", "ObjectBuilder", "config", "faults", "utils","setup","powershell", "messageInterfaces", "impl\messageInterfaces", "config", "logging", "Impl\ObjectBuilder.Common", "installation", "messagemutator", "encryption", "unitofwork", "masterNode", "impl\installation", "impl\unicast\NServiceBus.Unicast.Msmq", "impl\Serializers","forms", "impl\licensing", "unicast", "headers", "impersonation", "impl\unicast\transport", "impl\unicast\queuing", "impl\unicast\NServiceBus.Unicast.Subscriptions.Msmq", "impl\unicast\NServiceBus.Unicast.Subscriptions.InMemory", "impl\faults", "impl\encryption", "databus", "impl\Sagas", "impl\SagaPersisters\InMemory", "impl\SagaPersisters\RavenSagaPersister", "impl\unicast\NServiceBus.Unicast.Subscriptions.Raven", "integration", "impl\databus", "distributor", "gateway", "scheduling", "satellites", "management\retries", "timeout"
$coreDirs = "unicastTransport", "ObjectBuilder", "config", "faults", "utils","setup","powershell", "messageInterfaces", "impl\messageInterfaces", "config", "logging", "Impl\ObjectBuilder.Common", "installation", "messagemutator", "encryption", "unitofwork", "impl\installation", "impl\unicast\NServiceBus.Unicast.Msmq", "impl\Serializers","forms", "impl\licensing", "unicast", "headers", "impersonation", "impl\unicast\transport", "impl\unicast\queuing", "impl\unicast\NServiceBus.Unicast.Subscriptions.Msmq", "impl\unicast\NServiceBus.Unicast.Subscriptions.InMemory", "impl\faults", "impl\encryption", "databus", "impl\Sagas", "impl\SagaPersisters\InMemory", "impl\SagaPersisters\RavenSagaPersister", "impl\unicast\NServiceBus.Unicast.Subscriptions.Raven", "integration", "impl\databus", "distributor", "gateway", "scheduling", "satellites", "management\retries", "timeout"
$coreDirs | % {
$solutionDir = Resolve-Path "$srcDir\$_"
cd $solutionDir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace NServiceBus
{
using System;
using Distributor.Config;
using Unicast;

public static class ConfigureDistributor
{
Expand Down Expand Up @@ -44,7 +45,7 @@ public static Configure RunDistributor(this Configure config, bool withWorker =

if (withWorker)
{
workerRunsOnThisEndpoint = true;
UnicastBus.WorkerRunsOnThisEndpoint = workerRunsOnThisEndpoint = true;
WorkerInitializer.Init();
}

Expand All @@ -70,7 +71,7 @@ public static Configure RunDistributorWithNoWorkerOnItsEndpoint(this Configure c
/// <returns></returns>
public static Configure EnlistWithDistributor(this Configure config)
{
workerRunsOnThisEndpoint = true;
UnicastBus.WorkerRunsOnThisEndpoint = workerRunsOnThisEndpoint = true;

ValidateMasterNodeConfigurationForWorker(config);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,16 @@ public static void Init()

var unicastBusConfig = Configure.GetConfigSection<UnicastBusConfig>();

//allow users to override controll address in config
//allow users to override control address in config
if (unicastBusConfig != null && !string.IsNullOrWhiteSpace(unicastBusConfig.DistributorControlAddress))
distributorControlAddress = Address.Parse(unicastBusConfig.DistributorControlAddress);

config.Configurer.ConfigureComponent<ReadyMessageSender>(DependencyLifecycle.SingleInstance)
.ConfigureProperty(p => p.DistributorControlAddress, distributorControlAddress);


var distributorDataAddress = masterNodeAddress;

//allow users to override data address in config
if (unicastBusConfig != null && !string.IsNullOrWhiteSpace(unicastBusConfig.DistributorDataAddress))
distributorDataAddress = Address.Parse(unicastBusConfig.DistributorDataAddress);



config.Configurer.ConfigureComponent<ReturnAddressRewriter>(
DependencyLifecycle.SingleInstance)
.ConfigureProperty(r => r.DistributorDataAddress, distributorDataAddress);
.ConfigureProperty(r => r.DistributorDataAddress, masterNodeAddress);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ public void Run()

EndpointTransport.FinishedMessageProcessing += (a, b) =>
{
if (((IBus)Bus).CurrentMessageContext.Headers.ContainsKey(NServiceBus.Headers.Retries))
if (Bus.CurrentMessageContext.Headers.ContainsKey(NServiceBus.Headers.Retries))
{
return;
}
SendReadyMessage(1);
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
namespace NServiceBus.Gateway.Tests.HeaderManagement
{
using System;
using System.Collections.Generic;
using MessageHeaders;
{
using System.Collections.Generic;
using NUnit.Framework;
using Gateway.HeaderManagement;
using Rhino.Mocks;
using Gateway.HeaderManagement;
using Unicast.Transport;

[TestFixture]
Expand All @@ -31,7 +28,8 @@ public void SetUp()
ReplyToAddress = addressOfOriginatingEndpoint
};

incomingMessage.Headers[Headers.OriginatingSite]=originatingSite;
incomingMessage.Headers[Headers.OriginatingSite] = originatingSite;
incomingMessage.Headers[Headers.HttpFrom] = originatingSite;

gatewayHeaderManager = new GatewayHeaderManager();

Expand All @@ -50,7 +48,7 @@ public void Should_use_the_originating_sitekey_as_destination_for_response_messa
{
gatewayHeaderManager.MutateOutgoing(null, responseMessage);

Assert.AreEqual(responseMessage.Headers[Headers.DestinationSites],originatingSite);
Assert.AreEqual(responseMessage.Headers[Headers.HttpTo], originatingSite);
}

[Test]
Expand Down
1 change: 0 additions & 1 deletion src/gateway/NServiceBus.Gateway/Config/ConfigureGateway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ static void ConfigureSiteRouters(Configure config)
static void ConfigureReceiver(Configure config)
{
config.Configurer.ConfigureComponent<GatewayReceiver>(DependencyLifecycle.SingleInstance);
config.Configurer.ConfigureComponent<LegacyEndpointRouter>(DependencyLifecycle.SingleInstance);
config.Configurer.ConfigureComponent<MessageNotifier>(DependencyLifecycle.SingleInstance);
config.Configurer.ConfigureComponent<IdempotentChannelReceiver>(DependencyLifecycle.InstancePerCall);

Expand Down
1 change: 0 additions & 1 deletion src/gateway/NServiceBus.Gateway/NServiceBus.Gateway.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@
<Compile Include="Sending\IdempotentChannelForwarder.cs" />
<Compile Include="Sending\IForwardMessagesToSites.cs" />
<Compile Include="Routing\Endpoints\DefaultEndpointRouter.cs" />
<Compile Include="Routing\Endpoints\LegacyEndpointRouter.cs" />
<Compile Include="Routing\IRouteMessagesToEndpoints.cs" />
<Compile Include="Routing\Sites\ConfigurationBasedSiteRouter.cs" />
<Compile Include="Config\ConfigureGateway.cs" />
Expand Down

This file was deleted.

75 changes: 39 additions & 36 deletions src/gateway/NServiceBus.Gateway/Routing/Sites/LegacySiteRouter.cs
Original file line number Diff line number Diff line change
@@ -1,37 +1,40 @@
namespace NServiceBus.Gateway.Routing.Sites
{
using System.Collections.Generic;
using System.Configuration;
using Channels;
using Unicast.Transport;

public class LegacySiteRouter:IRouteMessagesToSites
{
readonly string remoteUrl;

public LegacySiteRouter()
{
remoteUrl = ConfigurationManager.AppSettings["RemoteUrl"];
}

public IEnumerable<Site> GetDestinationSitesFor(TransportMessage messageToDispatch)
{
var address = GetRemoteAddress(messageToDispatch);

return new []{new Site
{
Channel = new Channel{Address = address,Type = "Http"},
Key = address
}};
}

string GetRemoteAddress(TransportMessage msg)
{
if (msg.Headers.ContainsKey(Headers.HttpTo))
return msg.Headers[Headers.HttpTo];

return remoteUrl;
}

}
namespace NServiceBus.Gateway.Routing.Sites
{
using System.Collections.Generic;
using System.Configuration;
using Channels;
using Unicast.Transport;

public class LegacySiteRouter : IRouteMessagesToSites
{
private readonly string remoteUrl;

public LegacySiteRouter()
{
remoteUrl = ConfigurationManager.AppSettings["RemoteUrl"];
}

public IEnumerable<Site> GetDestinationSitesFor(TransportMessage messageToDispatch)
{
var address = GetRemoteAddress(messageToDispatch);

return new[]
{
new Site
{
Channel = new Channel {Address = address, Type = "Http"},
Key = address
}
};
}

private string GetRemoteAddress(TransportMessage msg)
{
if (msg.Headers.ContainsKey(Headers.HttpTo))
return msg.Headers[Headers.HttpTo];

return remoteUrl;
}

}
}
2 changes: 1 addition & 1 deletion src/hosting/NServiceBus.Hosting/GenericHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public GenericHost(IConfigureThisEndpoint specifier, string[] args, IEnumerable<
ProfileActivator.ProfileManager = profileManager;

configManager = new ConfigManager(assembliesToScan, specifier);
wcfManager = new WcfManager(assembliesToScan);
wcfManager = new WcfManager();
roleManager = new RoleManager(assembliesToScan);
}

Expand Down
38 changes: 13 additions & 25 deletions src/hosting/NServiceBus.Hosting/Wcf/WcfManager.cs
Original file line number Diff line number Diff line change
@@ -1,39 +1,27 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.ServiceModel;
using System.ServiceModel.Channels;
using log4net;

namespace NServiceBus.Hosting.Wcf
{
namespace NServiceBus.Hosting.Wcf
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Channels;
using log4net;

/// <summary>
/// Enable users to expose messages as WCF services
/// </summary>
public class WcfManager
{
private readonly List<Type> serviceTypes = new List<Type>();
private readonly List<ServiceHost> hosts = new List<ServiceHost>();

/// <summary>
/// Initlalized the manager with the list of assemblies to be scanned
/// </summary>
/// <param name="assembliesToScan"></param>
public WcfManager(IEnumerable<Assembly> assembliesToScan)
{
foreach (var a in assembliesToScan)
foreach (var t in a.GetTypes())
if (IsWcfService(t) && !t.IsAbstract)
serviceTypes.Add(t);
}

/// <summary>
/// Starts a servicehost for each found service. Defaults to BasicHttpBinding if
/// no user specified binding is found
/// </summary>
public void Startup()
{
foreach (var serviceType in serviceTypes)
{

foreach (var serviceType in Configure.TypesToScan.Where(t => !t.IsAbstract && IsWcfService(t)))
{
var host = new WcfServiceHost(serviceType);

Expand Down Expand Up @@ -72,7 +60,7 @@ private static bool IsWcfService(Type t)
{
var args = t.GetGenericArguments();
if (args.Length == 2)
if (typeof(IMessage).IsAssignableFrom(args[0]))
if (args[0].IsMessageType())
{
var wcfType = typeof(WcfService<,>).MakeGenericType(args);
if (wcfType.IsAssignableFrom(t))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,15 @@
<Reference Include="NServiceBus.Installation">
<HintPath>..\..\..\..\..\build\nservicebus.core\NServiceBus.Installation.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.MasterNode, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\build\nservicebus.core\NServiceBus.MasterNode.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.ObjectBuilder">
<HintPath>..\..\..\..\..\build\nservicebus.core\NServiceBus.ObjectBuilder.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.ObjectBuilder.DefaultBuilder">
<HintPath>..\..\..\..\..\build\nservicebus.core\NServiceBus.ObjectBuilder.DefaultBuilder.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.Unicast.Config">
<HintPath>..\..\..\..\..\build\nservicebus.core\NServiceBus.Unicast.Config.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.UnitOfWork">
<HintPath>..\..\..\..\..\build\nservicebus.core\NServiceBus.UnitOfWork.dll</HintPath>
</Reference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@
<Reference Include="NServiceBus.Installation.Windows">
<HintPath>..\..\..\..\..\build\nservicebus.core\NServiceBus.Installation.Windows.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.MasterNode">
<HintPath>..\..\..\..\..\build\nservicebus.core\NServiceBus.MasterNode.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.ObjectBuilder">
<HintPath>..\..\..\..\..\build\nservicebus.core\NServiceBus.ObjectBuilder.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.Setup.Windows">
<HintPath>..\..\..\..\..\build\nservicebus.core\NServiceBus.Setup.Windows.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.Unicast.Config">
<HintPath>..\..\..\..\..\build\nservicebus.core\NServiceBus.Unicast.Config.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.UnitOfWork">
<HintPath>..\..\..\..\..\build\nservicebus.core\NServiceBus.UnitOfWork.dll</HintPath>
</Reference>
Expand Down
Loading

0 comments on commit 9b607a2

Please sign in to comment.