Skip to content

Commit 4ad1a29

Browse files
committed
feat: Enhance SQS templates with additional configuration and registration options
1 parent 01a6b36 commit 4ad1a29

File tree

10 files changed

+133
-12
lines changed

10 files changed

+133
-12
lines changed

Modules/Intent.Modules.Aws.Sqs/Intent.Modules.Aws.Sqs.application.output.log

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,125 @@
2424
<ProjectRelativeFilePath>Intent.Modules.Aws.Sqs.csproj</ProjectRelativeFilePath>
2525
<IsIgnored>false</IsIgnored>
2626
</FileLog>
27+
<FileLog>
28+
<ProjectId>1afe4d6c-576d-450e-8eda-9afdf05dd268</ProjectId>
29+
<CorrelationId>Intent.ModuleBuilder.CSharp.Templates.CSharpTemplatePartial#ee5c1c94-51bf-40fe-a3a6-fcb8d3942285</CorrelationId>
30+
<OverwriteBehaviour>always</OverwriteBehaviour>
31+
<ApplicationRelativeFilePath>Templates/SqsConfiguration/SqsConfigurationTemplatePartial.cs</ApplicationRelativeFilePath>
32+
<ProjectRelativeFilePath>SqsConfiguration/SqsConfigurationTemplatePartial.cs</ProjectRelativeFilePath>
33+
<IsIgnored>false</IsIgnored>
34+
</FileLog>
35+
<FileLog>
36+
<ProjectId>1afe4d6c-576d-450e-8eda-9afdf05dd268</ProjectId>
37+
<CorrelationId>Intent.ModuleBuilder.TemplateRegistration.SingleFileNoModel#ee5c1c94-51bf-40fe-a3a6-fcb8d3942285</CorrelationId>
38+
<OverwriteBehaviour>always</OverwriteBehaviour>
39+
<ApplicationRelativeFilePath>Templates/SqsConfiguration/SqsConfigurationTemplateRegistration.cs</ApplicationRelativeFilePath>
40+
<ProjectRelativeFilePath>SqsConfiguration/SqsConfigurationTemplateRegistration.cs</ProjectRelativeFilePath>
41+
<IsIgnored>false</IsIgnored>
42+
</FileLog>
43+
<FileLog>
44+
<ProjectId>1afe4d6c-576d-450e-8eda-9afdf05dd268</ProjectId>
45+
<CorrelationId>Intent.ModuleBuilder.CSharp.Templates.CSharpTemplatePartial#bf066704-3da5-42bd-9a56-b523e7e9ec01</CorrelationId>
46+
<OverwriteBehaviour>always</OverwriteBehaviour>
47+
<ApplicationRelativeFilePath>Templates/SqsEventBus/SqsEventBusTemplatePartial.cs</ApplicationRelativeFilePath>
48+
<ProjectRelativeFilePath>SqsEventBus/SqsEventBusTemplatePartial.cs</ProjectRelativeFilePath>
49+
<IsIgnored>false</IsIgnored>
50+
</FileLog>
51+
<FileLog>
52+
<ProjectId>1afe4d6c-576d-450e-8eda-9afdf05dd268</ProjectId>
53+
<CorrelationId>Intent.ModuleBuilder.TemplateRegistration.SingleFileNoModel#bf066704-3da5-42bd-9a56-b523e7e9ec01</CorrelationId>
54+
<OverwriteBehaviour>always</OverwriteBehaviour>
55+
<ApplicationRelativeFilePath>Templates/SqsEventBus/SqsEventBusTemplateRegistration.cs</ApplicationRelativeFilePath>
56+
<ProjectRelativeFilePath>SqsEventBus/SqsEventBusTemplateRegistration.cs</ProjectRelativeFilePath>
57+
<IsIgnored>false</IsIgnored>
58+
</FileLog>
59+
<FileLog>
60+
<ProjectId>1afe4d6c-576d-450e-8eda-9afdf05dd268</ProjectId>
61+
<CorrelationId>Intent.ModuleBuilder.CSharp.Templates.CSharpTemplatePartial#ca1bcc68-cb42-48d4-b02c-d2d43ba3d76a</CorrelationId>
62+
<OverwriteBehaviour>always</OverwriteBehaviour>
63+
<ApplicationRelativeFilePath>Templates/SqsMessageDispatcher/SqsMessageDispatcherTemplatePartial.cs</ApplicationRelativeFilePath>
64+
<ProjectRelativeFilePath>SqsMessageDispatcher/SqsMessageDispatcherTemplatePartial.cs</ProjectRelativeFilePath>
65+
<IsIgnored>false</IsIgnored>
66+
</FileLog>
67+
<FileLog>
68+
<ProjectId>1afe4d6c-576d-450e-8eda-9afdf05dd268</ProjectId>
69+
<CorrelationId>Intent.ModuleBuilder.TemplateRegistration.SingleFileNoModel#ca1bcc68-cb42-48d4-b02c-d2d43ba3d76a</CorrelationId>
70+
<OverwriteBehaviour>always</OverwriteBehaviour>
71+
<ApplicationRelativeFilePath>Templates/SqsMessageDispatcher/SqsMessageDispatcherTemplateRegistration.cs</ApplicationRelativeFilePath>
72+
<ProjectRelativeFilePath>SqsMessageDispatcher/SqsMessageDispatcherTemplateRegistration.cs</ProjectRelativeFilePath>
73+
<IsIgnored>false</IsIgnored>
74+
</FileLog>
75+
<FileLog>
76+
<ProjectId>1afe4d6c-576d-450e-8eda-9afdf05dd268</ProjectId>
77+
<CorrelationId>Intent.ModuleBuilder.CSharp.Templates.CSharpTemplatePartial#1aa80bc0-b573-46b7-8bcd-54bddf18337c</CorrelationId>
78+
<OverwriteBehaviour>always</OverwriteBehaviour>
79+
<ApplicationRelativeFilePath>Templates/SqsMessageDispatcherInterface/SqsMessageDispatcherInterfaceTemplatePartial.cs</ApplicationRelativeFilePath>
80+
<ProjectRelativeFilePath>SqsMessageDispatcherInterface/SqsMessageDispatcherInterfaceTemplatePartial.cs</ProjectRelativeFilePath>
81+
<IsIgnored>false</IsIgnored>
82+
</FileLog>
83+
<FileLog>
84+
<ProjectId>1afe4d6c-576d-450e-8eda-9afdf05dd268</ProjectId>
85+
<CorrelationId>Intent.ModuleBuilder.TemplateRegistration.SingleFileNoModel#1aa80bc0-b573-46b7-8bcd-54bddf18337c</CorrelationId>
86+
<OverwriteBehaviour>always</OverwriteBehaviour>
87+
<ApplicationRelativeFilePath>Templates/SqsMessageDispatcherInterface/SqsMessageDispatcherInterfaceTemplateRegistration.cs</ApplicationRelativeFilePath>
88+
<ProjectRelativeFilePath>SqsMessageDispatcherInterface/SqsMessageDispatcherInterfaceTemplateRegistration.cs</ProjectRelativeFilePath>
89+
<IsIgnored>false</IsIgnored>
90+
</FileLog>
91+
<FileLog>
92+
<ProjectId>1afe4d6c-576d-450e-8eda-9afdf05dd268</ProjectId>
93+
<CorrelationId>Intent.ModuleBuilder.CSharp.Templates.CSharpStringInterpolationTemplate#24d4155d-a246-4bbe-a606-5bdae1abfa53</CorrelationId>
94+
<OverwriteBehaviour>always</OverwriteBehaviour>
95+
<ApplicationRelativeFilePath>Templates/SqsPublisherOptions/SqsPublisherOptionsTemplate.cs</ApplicationRelativeFilePath>
96+
<ProjectRelativeFilePath>SqsPublisherOptions/SqsPublisherOptionsTemplate.cs</ProjectRelativeFilePath>
97+
<IsIgnored>false</IsIgnored>
98+
</FileLog>
99+
<FileLog>
100+
<ProjectId>1afe4d6c-576d-450e-8eda-9afdf05dd268</ProjectId>
101+
<CorrelationId>Intent.ModuleBuilder.CSharp.Templates.CSharpTemplatePartial#24d4155d-a246-4bbe-a606-5bdae1abfa53</CorrelationId>
102+
<OverwriteBehaviour>always</OverwriteBehaviour>
103+
<ApplicationRelativeFilePath>Templates/SqsPublisherOptions/SqsPublisherOptionsTemplatePartial.cs</ApplicationRelativeFilePath>
104+
<ProjectRelativeFilePath>SqsPublisherOptions/SqsPublisherOptionsTemplatePartial.cs</ProjectRelativeFilePath>
105+
<IsIgnored>false</IsIgnored>
106+
</FileLog>
107+
<FileLog>
108+
<ProjectId>1afe4d6c-576d-450e-8eda-9afdf05dd268</ProjectId>
109+
<CorrelationId>Intent.ModuleBuilder.TemplateRegistration.SingleFileNoModel#24d4155d-a246-4bbe-a606-5bdae1abfa53</CorrelationId>
110+
<OverwriteBehaviour>always</OverwriteBehaviour>
111+
<ApplicationRelativeFilePath>Templates/SqsPublisherOptions/SqsPublisherOptionsTemplateRegistration.cs</ApplicationRelativeFilePath>
112+
<ProjectRelativeFilePath>SqsPublisherOptions/SqsPublisherOptionsTemplateRegistration.cs</ProjectRelativeFilePath>
113+
<IsIgnored>false</IsIgnored>
114+
</FileLog>
115+
<FileLog>
116+
<ProjectId>1afe4d6c-576d-450e-8eda-9afdf05dd268</ProjectId>
117+
<CorrelationId>Intent.ModuleBuilder.CSharp.Templates.CSharpStringInterpolationTemplate#dcf5eb00-00b5-43fd-a708-933057e63d34</CorrelationId>
118+
<OverwriteBehaviour>always</OverwriteBehaviour>
119+
<ApplicationRelativeFilePath>Templates/SqsSubscriptionOptions/SqsSubscriptionOptionsTemplate.cs</ApplicationRelativeFilePath>
120+
<ProjectRelativeFilePath>SqsSubscriptionOptions/SqsSubscriptionOptionsTemplate.cs</ProjectRelativeFilePath>
121+
<IsIgnored>false</IsIgnored>
122+
</FileLog>
123+
<FileLog>
124+
<ProjectId>1afe4d6c-576d-450e-8eda-9afdf05dd268</ProjectId>
125+
<CorrelationId>Intent.ModuleBuilder.CSharp.Templates.CSharpTemplatePartial#dcf5eb00-00b5-43fd-a708-933057e63d34</CorrelationId>
126+
<OverwriteBehaviour>always</OverwriteBehaviour>
127+
<ApplicationRelativeFilePath>Templates/SqsSubscriptionOptions/SqsSubscriptionOptionsTemplatePartial.cs</ApplicationRelativeFilePath>
128+
<ProjectRelativeFilePath>SqsSubscriptionOptions/SqsSubscriptionOptionsTemplatePartial.cs</ProjectRelativeFilePath>
129+
<IsIgnored>false</IsIgnored>
130+
</FileLog>
131+
<FileLog>
132+
<ProjectId>1afe4d6c-576d-450e-8eda-9afdf05dd268</ProjectId>
133+
<CorrelationId>Intent.ModuleBuilder.TemplateRegistration.SingleFileNoModel#dcf5eb00-00b5-43fd-a708-933057e63d34</CorrelationId>
134+
<OverwriteBehaviour>always</OverwriteBehaviour>
135+
<ApplicationRelativeFilePath>Templates/SqsSubscriptionOptions/SqsSubscriptionOptionsTemplateRegistration.cs</ApplicationRelativeFilePath>
136+
<ProjectRelativeFilePath>SqsSubscriptionOptions/SqsSubscriptionOptionsTemplateRegistration.cs</ProjectRelativeFilePath>
137+
<IsIgnored>false</IsIgnored>
138+
</FileLog>
139+
<FileLog>
140+
<ProjectId>1afe4d6c-576d-450e-8eda-9afdf05dd268</ProjectId>
141+
<CorrelationId>Intent.ModuleBuilder.Templates.TemplateExtensions#86af6e24-00ab-4a2b-aa32-86ab541ba455</CorrelationId>
142+
<OverwriteBehaviour>always</OverwriteBehaviour>
143+
<ApplicationRelativeFilePath>Templates/TemplateExtensions.cs</ApplicationRelativeFilePath>
144+
<ProjectRelativeFilePath>TemplateExtensions.cs</ProjectRelativeFilePath>
145+
<IsIgnored>false</IsIgnored>
146+
</FileLog>
27147
</FileLogs>
28148
</outputLog>

Modules/Intent.Modules.Aws.Sqs/Templates/SqsConfiguration/SqsConfigurationTemplatePartial.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ public partial class SqsConfigurationTemplate : CSharpTemplateBase<object>, ICSh
2929
public const string TemplateId = "Intent.Aws.Sqs.SqsConfiguration";
3030

3131
[IntentManaged(Mode.Fully, Body = Mode.Ignore)]
32-
public SqsConfigurationTemplate(IOutputTarget outputTarget, object? model = null) : base(TemplateId, outputTarget, model)
32+
public SqsConfigurationTemplate(IOutputTarget outputTarget, object model = null) : base(TemplateId, outputTarget, model)
3333
{
3434
AddNugetDependency(NugetPackages.AwsSdkSqs(OutputTarget));
3535
AddNugetDependency(NugetPackages.AwsSdkExtensionsNetCoreSetup(OutputTarget));
36-
36+
3737
CSharpFile = new CSharpFile(this.GetNamespace(), this.GetFolderPath())
3838
.AddUsing("System")
3939
.AddUsing("Microsoft.Extensions.Configuration")
@@ -69,7 +69,7 @@ public SqsConfigurationTemplate(IOutputTarget outputTarget, object? model = null
6969
.WithoutSemicolon());
7070
}));
7171
});
72-
72+
7373
method.AddElseStatement(elseStmt =>
7474
{
7575
elseStmt.AddStatement("// Production AWS");
@@ -78,7 +78,7 @@ public SqsConfigurationTemplate(IOutputTarget outputTarget, object? model = null
7878

7979
// Register event bus
8080
method.AddStatement($"services.AddScoped<{this.GetEventBusInterfaceName()}, {this.GetTypeName(SqsEventBusTemplate.TemplateId)}>();", stmt => stmt.SeparatedFromPrevious());
81-
81+
8282
// Register dispatcher
8383
method.AddStatement($"services.AddSingleton<{this.GetTypeName(SqsMessageDispatcherTemplate.TemplateId)}>();");
8484
method.AddStatement($"services.AddSingleton<{this.GetTypeName(SqsMessageDispatcherInterfaceTemplate.TemplateId)}, {this.GetTypeName(SqsMessageDispatcherTemplate.TemplateId)}>(sp => sp.GetRequiredService<{this.GetTypeName(SqsMessageDispatcherTemplate.TemplateId)}>());");

Modules/Intent.Modules.Aws.Sqs/Templates/SqsEventBus/SqsEventBusTemplatePartial.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public partial class SqsEventBusTemplate : CSharpTemplateBase<object>, ICSharpFi
2121
public const string TemplateId = "Intent.Aws.Sqs.SqsEventBus";
2222

2323
[IntentManaged(Mode.Fully, Body = Mode.Ignore)]
24-
public SqsEventBusTemplate(IOutputTarget outputTarget, object? model = null) : base(TemplateId, outputTarget, model)
24+
public SqsEventBusTemplate(IOutputTarget outputTarget, object model = null) : base(TemplateId, outputTarget, model)
2525
{
2626
AddNugetDependency(NugetPackages.AwsSdkSqs(OutputTarget));
2727
CSharpFile = new CSharpFile(this.GetNamespace(), this.GetFolderPath())

Modules/Intent.Modules.Aws.Sqs/Templates/SqsMessageDispatcher/SqsMessageDispatcherTemplatePartial.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public partial class SqsMessageDispatcherTemplate : CSharpTemplateBase<object>,
2222
public const string TemplateId = "Intent.Aws.Sqs.SqsMessageDispatcher";
2323

2424
[IntentManaged(Mode.Fully, Body = Mode.Ignore)]
25-
public SqsMessageDispatcherTemplate(IOutputTarget outputTarget, object? model = null) : base(TemplateId, outputTarget, model)
25+
public SqsMessageDispatcherTemplate(IOutputTarget outputTarget, object model = null) : base(TemplateId, outputTarget, model)
2626
{
2727
AddNugetDependency(NugetPackages.AmazonLambdaSqsEvents(OutputTarget));
2828
CSharpFile = new CSharpFile(this.GetNamespace(), this.GetFolderPath())
@@ -60,7 +60,7 @@ public SqsMessageDispatcherTemplate(IOutputTarget outputTarget, object? model =
6060
? messageTypeAttr.StringValue
6161
: throw new Exception("MessageType attribute is missing");
6262
""", stmt => stmt.SeparatedFromPrevious());
63-
63+
6464
method.AddIfStatement("_handlers.TryGetValue(messageTypeName, out var handlerAsync)",
6565
block => { block.AddStatement("await handlerAsync(scopedServiceProvider, sqsMessage, cancellationToken);"); });
6666
});

Modules/Intent.Modules.Aws.Sqs/Templates/SqsMessageDispatcherInterface/SqsMessageDispatcherInterfaceTemplatePartial.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public partial class SqsMessageDispatcherInterfaceTemplate : CSharpTemplateBase<
1919
public const string TemplateId = "Intent.Aws.Sqs.SqsMessageDispatcherInterface";
2020

2121
[IntentManaged(Mode.Fully, Body = Mode.Ignore)]
22-
public SqsMessageDispatcherInterfaceTemplate(IOutputTarget outputTarget, object? model = null) : base(TemplateId, outputTarget, model)
22+
public SqsMessageDispatcherInterfaceTemplate(IOutputTarget outputTarget, object model = null) : base(TemplateId, outputTarget, model)
2323
{
2424
CSharpFile = new CSharpFile(this.GetNamespace(), this.GetFolderPath())
2525
.AddUsing("System")

Modules/Intent.Modules.Aws.Sqs/Templates/SqsPublisherOptions/SqsPublisherOptionsTemplate.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Intent.RoslynWeaver.Attributes;
22

33
[assembly: DefaultIntentManaged(Mode.Fully)]
4-
[assembly: IntentTemplate("Intent.ModuleBuilder.CSharp.Templates.CSharpStringInterpolationTemplate", Version = "1.0")]
4+
[assembly: IntentTemplate("Intent.ModuleBuilder.CSharp.Templates.CSharpStringInterpolationTemplate", Version= "1.0")]
55

66
namespace Intent.Modules.Aws.Sqs.Templates.SqsPublisherOptions
77
{

Modules/Intent.Modules.Aws.Sqs/Templates/SqsPublisherOptions/SqsPublisherOptionsTemplatePartial.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ partial class SqsPublisherOptionsTemplate : CSharpTemplateBase<object>
1818
public const string TemplateId = "Intent.Aws.Sqs.SqsPublisherOptions";
1919

2020
[IntentManaged(Mode.Fully, Body = Mode.Ignore)]
21-
public SqsPublisherOptionsTemplate(IOutputTarget outputTarget, object? model = null) : base(TemplateId, outputTarget, model)
21+
public SqsPublisherOptionsTemplate(IOutputTarget outputTarget, object model = null) : base(TemplateId, outputTarget, model)
2222
{
2323
}
2424

Modules/Intent.Modules.Aws.Sqs/Templates/SqsSubscriptionOptions/SqsSubscriptionOptionsTemplate.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using Intent.RoslynWeaver.Attributes;
33

44
[assembly: DefaultIntentManaged(Mode.Fully)]
5-
[assembly: IntentTemplate("Intent.ModuleBuilder.CSharp.Templates.CSharpStringInterpolationTemplate", Version = "1.0")]
5+
[assembly: IntentTemplate("Intent.ModuleBuilder.CSharp.Templates.CSharpStringInterpolationTemplate", Version= "1.0")]
66

77
namespace Intent.Modules.Aws.Sqs.Templates.SqsSubscriptionOptions
88
{

Modules/Intent.Modules.Aws.Sqs/Templates/SqsSubscriptionOptions/SqsSubscriptionOptionsTemplatePartial.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ partial class SqsSubscriptionOptionsTemplate : CSharpTemplateBase<object>
1919
public const string SubscriptionEntry = "SubscriptionEntry";
2020

2121
[IntentManaged(Mode.Fully, Body = Mode.Ignore)]
22-
public SqsSubscriptionOptionsTemplate(IOutputTarget outputTarget, object? model = null) : base(TemplateId, outputTarget, model)
22+
public SqsSubscriptionOptionsTemplate(IOutputTarget outputTarget, object model = null) : base(TemplateId, outputTarget, model)
2323
{
2424
}
2525

Modules/Intent.Modules.Aws.Sqs/Templates/TemplateExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Collections.Generic;
12
using Intent.Modules.Aws.Sqs.Templates.SqsConfiguration;
23
using Intent.Modules.Aws.Sqs.Templates.SqsEventBus;
34
using Intent.Modules.Aws.Sqs.Templates.SqsMessageDispatcher;

0 commit comments

Comments
 (0)