Skip to content

Commit

Permalink
Removing a few premature abstractions
Browse files Browse the repository at this point in the history
Since the will start to clash with types in rabbitmq.client 3.4
  • Loading branch information
andreasohlund committed Feb 6, 2015
1 parent 32f7f24 commit b304abb
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ static RabbitMqConnectionManager SetupRabbitMqConnectionManager(string connectio
var config = new ConnectionStringParser(new SettingsHolder()).Parse(connectionString);
// config.OverrideClientProperties();
var selectionStrategy = new DefaultClusterHostSelectionStrategy<ConnectionFactoryInfo>();
var connectionFactory = new ConnectionFactoryWrapper(config, selectionStrategy);
var connectionFactory = new ClusterAwareConnectionFactory(config, selectionStrategy);
var newConnectionManager = new RabbitMqConnectionManager(connectionFactory, config);
return newConnectionManager;
}
Expand Down
2 changes: 1 addition & 1 deletion src/NServiceBus.RabbitMQ.Tests/RabbitMqContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void SetUp()
config.ParseHosts("localhost:5672");

var selectionStrategy = new DefaultClusterHostSelectionStrategy<ConnectionFactoryInfo>();
var connectionFactory = new ConnectionFactoryWrapper(config, selectionStrategy);
var connectionFactory = new ClusterAwareConnectionFactory(config, selectionStrategy);
connectionManager = new RabbitMqConnectionManager(connectionFactory, config);

publishChannel = connectionManager.GetPublishConnection().CreateModel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ protected override void Configure(FeatureConfigurationContext context, string co
{
context.Container.ConfigureComponent<RabbitMqConnectionManager>(DependencyLifecycle.SingleInstance);

context.Container.ConfigureComponent<IConnectionFactory>(builder => new ConnectionFactoryWrapper(builder.Build<IConnectionConfiguration>(), new DefaultClusterHostSelectionStrategy<ConnectionFactoryInfo>()), DependencyLifecycle.InstancePerCall);
context.Container.ConfigureComponent(builder => new ClusterAwareConnectionFactory(builder.Build<IConnectionConfiguration>(), new DefaultClusterHostSelectionStrategy<ConnectionFactoryInfo>()), DependencyLifecycle.InstancePerCall);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
using global::RabbitMQ.Client;
using NServiceBus.Transports.RabbitMQ.Config;

class ConnectionFactoryWrapper : IConnectionFactory
class ClusterAwareConnectionFactory
{
public IConnectionConfiguration Configuration { get; private set; }

public ConnectionFactoryWrapper(IConnectionConfiguration connectionConfiguration, IClusterHostSelectionStrategy<ConnectionFactoryInfo> clusterHostSelectionStrategy)
public ClusterAwareConnectionFactory(IConnectionConfiguration connectionConfiguration, IClusterHostSelectionStrategy<ConnectionFactoryInfo> clusterHostSelectionStrategy)
{
this.clusterHostSelectionStrategy = clusterHostSelectionStrategy;
if (connectionConfiguration == null)
Expand Down
16 changes: 0 additions & 16 deletions src/NServiceBus.RabbitMQ/Connection/IConnectionFactory.cs

This file was deleted.

3 changes: 1 addition & 2 deletions src/NServiceBus.RabbitMQ/NServiceBus.RabbitMQ.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,11 @@
<Compile Include="DefaultRoutingKeyConvention.cs" />
<Compile Include="Config\ConnectionConfiguration.cs" />
<Compile Include="Connection\ConnectionFactoryInfo.cs" />
<Compile Include="Connection\ConnectionFactoryWrapper.cs" />
<Compile Include="Connection\ClusterAwareConnectionFactory.cs" />
<Compile Include="Connection\DefaultClusterHostSelectionStrategy.cs" />
<Compile Include="Connection\HostConfiguration.cs" />
<Compile Include="Connection\IClusterHostSelectionStrategy.cs" />
<Compile Include="Config\IConnectionConfiguration.cs" />
<Compile Include="Connection\IConnectionFactory.cs" />
<Compile Include="Connection\IHostConfiguration.cs" />
<Compile Include="IChannelProvider.cs" />
<Compile Include="InternalsVisibleTo.cs" />
Expand Down
4 changes: 2 additions & 2 deletions src/NServiceBus.RabbitMQ/PersistentConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace NServiceBus.Transports.RabbitMQ
[SkipWeaving]
class PersistentConnection: IConnection
{
public PersistentConnection(IConnectionFactory connectionFactory, TimeSpan retryDelay,string purpose)
public PersistentConnection(ClusterAwareConnectionFactory connectionFactory, TimeSpan retryDelay,string purpose)
{
this.connectionFactory = connectionFactory;
this.retryDelay = retryDelay;
Expand Down Expand Up @@ -286,7 +286,7 @@ public void Dispose()

bool disposed;
IConnection connection;
readonly IConnectionFactory connectionFactory;
readonly ClusterAwareConnectionFactory connectionFactory;
readonly TimeSpan retryDelay;
readonly string purpose;

Expand Down
4 changes: 2 additions & 2 deletions src/NServiceBus.RabbitMQ/RabbitMqConnectionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class RabbitMqConnectionManager : IDisposable, IManageRabbitMqConnections
{
public RabbitMqConnectionManager(IConnectionFactory connectionFactory, IConnectionConfiguration connectionConfiguration)
public RabbitMqConnectionManager(ClusterAwareConnectionFactory connectionFactory, IConnectionConfiguration connectionConfiguration)
{
this.connectionFactory = connectionFactory;
this.connectionConfiguration = connectionConfiguration;
Expand Down Expand Up @@ -62,7 +62,7 @@ public void DisposeManaged()
}
}

IConnectionFactory connectionFactory;
ClusterAwareConnectionFactory connectionFactory;
IConnectionConfiguration connectionConfiguration;
PersistentConnection connectionConsume;
PersistentConnection connectionAdministration;
Expand Down

0 comments on commit b304abb

Please sign in to comment.