Skip to content

Commit e0d9fce

Browse files
Update Snippets (#7754)
* Add NSB10 Snippets for GatewayRaventDB * Add prerelease.txt * Add NSB10 snippets for GatewaySql * Add NSB10 Snippets for MetricsServiceControl * Add NSB10 Snippets for NonDurablePersistence * Add NSB10 Snippets for PerfCounters * Add NSB10 Snippets for PlatformConnector * Add NSB10 Snippets for PostgreSQL Transport * Add NSB10 Snippets for PropertyEncryption * Add NSB10 Snippets for RabbitMQ * Add NSB10 Snippets for Raven * Add NSB10 Snippets for RawMessaging * Add NSB10 Snippets for SagaAudit * Add NSB10 Snippets for SqlPersistence * Remove unneeded package references * Add NSB10 Snippets for SqlTransport
1 parent 8694529 commit e0d9fce

File tree

261 files changed

+6303
-19
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

261 files changed

+6303
-19
lines changed

Snippets/GatewayRavenDB/GatewayRavenDB.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GatewayRavenDB_3", "Gateway
1010
EndProject
1111
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GatewayRavenDB_4", "GatewayRavenDB_4\GatewayRavenDB_4.csproj", "{7D003D7B-AAB3-4F5A-83F6-8894BBE082F2}"
1212
EndProject
13+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GatewayRavenDB_5", "GatewayRavenDB_5\GatewayRavenDB_5.csproj", "{67B2986B-66DB-77FD-220F-8B9493B18AD6}"
14+
EndProject
1315
Global
1416
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1517
Debug|Any CPU = Debug|Any CPU
@@ -32,6 +34,10 @@ Global
3234
{7D003D7B-AAB3-4F5A-83F6-8894BBE082F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
3335
{7D003D7B-AAB3-4F5A-83F6-8894BBE082F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
3436
{7D003D7B-AAB3-4F5A-83F6-8894BBE082F2}.Release|Any CPU.Build.0 = Release|Any CPU
37+
{67B2986B-66DB-77FD-220F-8B9493B18AD6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
38+
{67B2986B-66DB-77FD-220F-8B9493B18AD6}.Debug|Any CPU.Build.0 = Debug|Any CPU
39+
{67B2986B-66DB-77FD-220F-8B9493B18AD6}.Release|Any CPU.ActiveCfg = Release|Any CPU
40+
{67B2986B-66DB-77FD-220F-8B9493B18AD6}.Release|Any CPU.Build.0 = Release|Any CPU
3541
EndGlobalSection
3642
GlobalSection(SolutionProperties) = preSolution
3743
HideSolutionNode = FALSE
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net10.0</TargetFramework>
4+
</PropertyGroup>
5+
<ItemGroup>
6+
<PackageReference Include="NServiceBus.Gateway.RavenDB" Version="5.0.0-alpha.1" />
7+
</ItemGroup>
8+
</Project>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using System;
2+
using NServiceBus;
3+
using Raven.Client.Documents;
4+
5+
class Usage
6+
{
7+
public void DefaultUsage(EndpointConfiguration endpointConfiguration)
8+
{
9+
#region DefaultUsage
10+
11+
var gatewayConfiguration = new RavenGatewayDeduplicationConfiguration((builder, _) =>
12+
{
13+
var documentStore = new DocumentStore
14+
{
15+
Urls = new[] { "database-server-url" },
16+
Database = "default-database-name"
17+
};
18+
19+
documentStore.Initialize();
20+
21+
return documentStore;
22+
})
23+
{
24+
// When running in a cluster, enable cluster wide transaction support
25+
EnableClusterWideTransactions = true,
26+
};
27+
28+
var gatewaySettings = endpointConfiguration.Gateway(gatewayConfiguration);
29+
#endregion
30+
}
31+
32+
public void CustomExpiration(RavenGatewayDeduplicationConfiguration gatewayConfiguration)
33+
{
34+
#region CustomExpiration
35+
gatewayConfiguration.DeduplicationDataTimeToLive = TimeSpan.FromDays(15);
36+
gatewayConfiguration.FrequencyToRunDeduplicationDataCleanup = 86400;
37+
#endregion
38+
}
39+
}

Snippets/GatewayRavenDB/GatewayRavenDB_5/prerelease.txt

Whitespace-only changes.

Snippets/GatewaySql/GatewaySql.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GatewaySql_2", "GatewaySql_
88
EndProject
99
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GatewaySql_3", "GatewaySql_3\GatewaySql_3.csproj", "{D51A77B0-B04E-40E9-A34C-1D49B9D65789}"
1010
EndProject
11+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GatewaySql_4", "GatewaySql_4\GatewaySql_4.csproj", "{85F3F55D-A204-50DB-47A6-394A2329EAEF}"
12+
EndProject
1113
Global
1214
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1315
Debug|Any CPU = Debug|Any CPU
@@ -26,6 +28,10 @@ Global
2628
{D51A77B0-B04E-40E9-A34C-1D49B9D65789}.Debug|Any CPU.Build.0 = Debug|Any CPU
2729
{D51A77B0-B04E-40E9-A34C-1D49B9D65789}.Release|Any CPU.ActiveCfg = Release|Any CPU
2830
{D51A77B0-B04E-40E9-A34C-1D49B9D65789}.Release|Any CPU.Build.0 = Release|Any CPU
31+
{85F3F55D-A204-50DB-47A6-394A2329EAEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
32+
{85F3F55D-A204-50DB-47A6-394A2329EAEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
33+
{85F3F55D-A204-50DB-47A6-394A2329EAEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
34+
{85F3F55D-A204-50DB-47A6-394A2329EAEF}.Release|Any CPU.Build.0 = Release|Any CPU
2935
EndGlobalSection
3036
GlobalSection(SolutionProperties) = preSolution
3137
HideSolutionNode = FALSE
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net10.0</TargetFramework>
4+
</PropertyGroup>
5+
<ItemGroup>
6+
<PackageReference Include="NServiceBus.Gateway.Sql" Version="4.0.0-alpha.1" />
7+
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.1.1" />
8+
</ItemGroup>
9+
</Project>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using NServiceBus;
2+
using Microsoft.Data.SqlClient;
3+
4+
class Usage
5+
{
6+
public void StandardUsage(EndpointConfiguration endpointConfiguration, string connectionString)
7+
{
8+
#region DefaultUsage
9+
var gatewayConfiguration = new SqlGatewayDeduplicationConfiguration();
10+
gatewayConfiguration.ConnectionBuilder(
11+
connectionBuilder: () =>
12+
{
13+
return new SqlConnection(connectionString);
14+
});
15+
16+
var gatewaySettings = endpointConfiguration.Gateway(gatewayConfiguration);
17+
#endregion
18+
}
19+
20+
public void SchemaAndTableName(EndpointConfiguration endpointConfiguration, string connectionString)
21+
{
22+
#region CustomizeSchemaAndTableName
23+
var gatewayConfiguration = new SqlGatewayDeduplicationConfiguration();
24+
gatewayConfiguration.Schema = "custom_schema";
25+
gatewayConfiguration.TableName = "CustomTableName";
26+
gatewayConfiguration.ConnectionBuilder(
27+
connectionBuilder: () =>
28+
{
29+
return new SqlConnection(connectionString);
30+
});
31+
32+
var gatewaySettings = endpointConfiguration.Gateway(gatewayConfiguration);
33+
#endregion
34+
}
35+
36+
public void WithEndpointName(SqlGatewayDeduplicationConfiguration gatewayConfiguration, string endpointName)
37+
{
38+
#region WithEndpointName
39+
gatewayConfiguration.TableName = $"{endpointName}_GatewayDeduplication";
40+
#endregion
41+
}
42+
}

Snippets/GatewaySql/GatewaySql_4/prerelease.txt

Whitespace-only changes.

Snippets/MetricsServiceControl/MetricsServiceControl.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MetricsServiceControl_4", "
88
EndProject
99
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MetricsServiceControl_5", "MetricsServiceControl_5\MetricsServiceControl_5.csproj", "{D41A1E73-08C9-4D11-A3E2-9E27C63E3397}"
1010
EndProject
11+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MetricsServiceControl_6", "MetricsServiceControl_6\MetricsServiceControl_6.csproj", "{36C29F54-CD55-4B18-C82E-0BB351E9C162}"
12+
EndProject
1113
Global
1214
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1315
Debug|Any CPU = Debug|Any CPU
@@ -26,6 +28,10 @@ Global
2628
{D41A1E73-08C9-4D11-A3E2-9E27C63E3397}.Debug|Any CPU.Build.0 = Debug|Any CPU
2729
{D41A1E73-08C9-4D11-A3E2-9E27C63E3397}.Release|Any CPU.ActiveCfg = Release|Any CPU
2830
{D41A1E73-08C9-4D11-A3E2-9E27C63E3397}.Release|Any CPU.Build.0 = Release|Any CPU
31+
{36C29F54-CD55-4B18-C82E-0BB351E9C162}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
32+
{36C29F54-CD55-4B18-C82E-0BB351E9C162}.Debug|Any CPU.Build.0 = Debug|Any CPU
33+
{36C29F54-CD55-4B18-C82E-0BB351E9C162}.Release|Any CPU.ActiveCfg = Release|Any CPU
34+
{36C29F54-CD55-4B18-C82E-0BB351E9C162}.Release|Any CPU.Build.0 = Release|Any CPU
2935
EndGlobalSection
3036
GlobalSection(SolutionProperties) = preSolution
3137
HideSolutionNode = FALSE
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using System;
2+
using System.Net;
3+
using System.Net.NetworkInformation;
4+
using NServiceBus;
5+
6+
class Configuration
7+
{
8+
void ConfigureEndpoint(EndpointConfiguration endpointConfiguration)
9+
{
10+
#region SendMetricDataToServiceControl
11+
const string SERVICE_CONTROL_METRICS_ADDRESS = "particular.monitoring";
12+
13+
var metrics = endpointConfiguration.EnableMetrics();
14+
15+
metrics.SendMetricDataToServiceControl(
16+
serviceControlMetricsAddress: SERVICE_CONTROL_METRICS_ADDRESS,
17+
interval: TimeSpan.FromMinutes(1),
18+
instanceId: "INSTANCE_ID_OPTIONAL");
19+
#endregion
20+
21+
#region ServiceControlTTBR
22+
23+
metrics.SetServiceControlMetricsMessageTTBR(TimeSpan.FromHours(1));
24+
25+
#endregion
26+
}
27+
void SendMetricDataToServiceControlHostId(EndpointConfiguration endpointConfiguration)
28+
{
29+
#region SendMetricDataToServiceControlHostId
30+
const string SERVICE_CONTROL_METRICS_ADDRESS = "particular.monitoring";
31+
32+
var endpointName = "MyEndpoint";
33+
var machineName = $"{Dns.GetHostName()}.{IPGlobalProperties.GetIPGlobalProperties().DomainName}";
34+
var instanceIdentifier = $"{endpointName}@{machineName}";
35+
36+
var metrics = endpointConfiguration.EnableMetrics();
37+
38+
metrics.SendMetricDataToServiceControl(
39+
serviceControlMetricsAddress: SERVICE_CONTROL_METRICS_ADDRESS,
40+
interval: TimeSpan.FromMinutes(1),
41+
instanceId: instanceIdentifier);
42+
#endregion
43+
}
44+
}

0 commit comments

Comments
 (0)