Skip to content

Commit b9b0d86

Browse files
authored
Merge pull request #10 from NCodeGroup/transports
Adding AmazonSQS transport
2 parents b512818 + ef0ae59 commit b9b0d86

26 files changed

+1297
-12
lines changed

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
99

10-
<AssemblyVersion>1.0.7</AssemblyVersion>
10+
<AssemblyVersion>1.0.8</AssemblyVersion>
1111
<FileVersion>$(AssemblyVersion)</FileVersion>
1212
<Version>$(AssemblyVersion)</Version>
1313

Example.ConsoleHost/Example.ConsoleHost.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
<ItemGroup>
2626
<ProjectReference Include="..\MassTransit.Extensions.Hosting.ActiveMq\MassTransit.Extensions.Hosting.ActiveMq.csproj" />
27+
<ProjectReference Include="..\MassTransit.Extensions.Hosting.AmazonSqs\MassTransit.Extensions.Hosting.AmazonSqs.csproj" />
2728
<ProjectReference Include="..\MassTransit.Extensions.Hosting.RabbitMq\MassTransit.Extensions.Hosting.RabbitMq.csproj" />
2829
<ProjectReference Include="..\MassTransit.Extensions.Hosting\MassTransit.Extensions.Hosting.csproj" />
2930
</ItemGroup>

Example.ConsoleHost/Program.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
using GreenPipes;
2121
using MassTransit.Extensions.Hosting;
2222
using MassTransit.Extensions.Hosting.ActiveMq;
23+
using MassTransit.Extensions.Hosting.AmazonSqs;
2324
using MassTransit.Extensions.Hosting.RabbitMq;
2425
using Microsoft.Extensions.Configuration;
2526
using Microsoft.Extensions.DependencyInjection;
@@ -118,6 +119,16 @@ private static void ConfigureServices(HostBuilderContext context, IServiceCollec
118119
});
119120
});
120121

122+
// AmazonSQS
123+
busBuilder.UseAmazonSqs(configuration.GetSection("MassTransit:AmazonSqs"), hostBuilder =>
124+
{
125+
hostBuilder.UseServiceScope();
126+
hostBuilder.AddReceiveEndpoint("example-queue-4", endpointBuilder =>
127+
{
128+
endpointBuilder.AddConsumer<ExampleConsumer>();
129+
});
130+
});
131+
121132
});
122133
}
123134

Example.ConsoleHost/appsettings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
"UseSsl": true,
1717
"Username": "guest",
1818
"Password": "guest"
19+
},
20+
21+
"AmazonSqs": {
22+
"ConnectionName": "connection-name-4",
23+
"RegionSystemName": "us-east-1",
24+
"AccessKey": "access-key-example",
25+
"SecretKey": "secret-key-example"
1926
}
2027

2128
}

Example.TopshelfHost/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private static void ConfigureServices(IConfiguration configuration, IServiceColl
100100
});
101101
});
102102

103-
// see `Example.ConsoleHost` for examples with other transports such as ActiveMq, etc.
103+
// see `Example.ConsoleHost` for examples with other transports such as ActiveMq, AmazonSqs, etc.
104104
});
105105
}
106106

MassTransit.Extensions.Hosting.ActiveMq/ActiveMqHostBuilder.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private ActiveMqHostBuilder(IServiceCollection services, string connectionName)
7676
/// </summary>
7777
/// <param name="services"><see cref="IServiceCollection"/></param>
7878
/// <param name="connectionName">The client-provided connection name.</param>
79-
/// <param name="hostAddress">The URI host address of the RabbitMQ host (example: rabbitmq://host:port/vhost).</param>
79+
/// <param name="hostAddress">The URI host address of the ActiveMQ host (example: activemq://host:port/).</param>
8080
public ActiveMqHostBuilder(IServiceCollection services, string connectionName, Uri hostAddress)
8181
: this(services, connectionName)
8282
{
@@ -108,9 +108,10 @@ public ActiveMqHostBuilder(IServiceCollection services, string connectionName, s
108108
/// Initializes a new instance of the <see cref="ActiveMqHostBuilder"/> class.
109109
/// </summary>
110110
/// <param name="services"><see cref="IServiceCollection"/></param>
111+
/// <param name="connectionName">The client-provided connection name.</param>
111112
/// <param name="configuration">The <see cref="IConfiguration"/> being bound.</param>
112-
public ActiveMqHostBuilder(IServiceCollection services, IConfiguration configuration)
113-
: this(services, configuration["ConnectionName"])
113+
public ActiveMqHostBuilder(IServiceCollection services, string connectionName, IConfiguration configuration)
114+
: this(services, connectionName)
114115
{
115116
if (configuration == null)
116117
throw new ArgumentNullException(nameof(configuration));

MassTransit.Extensions.Hosting.ActiveMq/ActiveMqOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class ActiveMqOptions
4747
public string ConnectionName { get; set; } = string.Empty;
4848

4949
/// <summary>
50-
/// Gets or sets the ActiveMQ address to connect to (rabbitmq://host:port/vhost).
50+
/// Gets or sets the ActiveMQ address to connect to (activemq://host:port/).
5151
/// </summary>
5252
public Uri HostAddress
5353
{

MassTransit.Extensions.Hosting.ActiveMq/UseActiveMqExtensions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ public static void UseActiveMq(this IMassTransitBuilder builder, IConfiguration
9494
if (configuration == null)
9595
throw new ArgumentNullException(nameof(configuration));
9696

97-
var hostBuilder = new ActiveMqHostBuilder(builder.Services, configuration);
97+
var connectionName = configuration["ConnectionName"];
98+
var hostBuilder = new ActiveMqHostBuilder(builder.Services, connectionName, configuration);
9899
hostConfigurator?.Invoke(hostBuilder);
99100
}
100101

MassTransit.Extensions.Hosting.ActiveMq/project.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44

55
<Description>MassTransit ActiveMQ configuration extensions using Microsoft.Extensions.Hosting.IHostedService and Microsoft.Extensions.DependencyInjection.</Description>
6-
<PackageTags>ActiveMq;MassTransit;IHostedService;Bus;Hosting</PackageTags>
6+
<PackageTags>ActiveMQ;MassTransit;IHostedService;Bus;Hosting</PackageTags>
77

88
</PropertyGroup>
99
</Project>

0 commit comments

Comments
 (0)