-
Notifications
You must be signed in to change notification settings - Fork 5
ASB transaction support #237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
27fa1db
first draft of transaction support
timbussmann f848ef7
add missing logging integration
timbussmann 440e356
tweaks
timbussmann 12a57dc
Add support for cross-entity transactions configuration via attribute
SeanFeldman 69dc522
Approve API
SeanFeldman 31a8f1b
switch invoked method based on transaction setting
timbussmann 1873644
please code style
timbussmann efcc044
make the generated code valid syntax
timbussmann 8849290
update approval files
timbussmann e944564
verify generated trigger compiles without errors
timbussmann 3cd1b6c
remove optional ctor parameter for public attribute properties
timbussmann 9ecd740
update tests
timbussmann 3124cc0
cleanup tests
timbussmann 4ecebe1
obsolete NServiceBusEndpointNameAttribute
timbussmann 3c64b9a
suppress CS0618
timbussmann 431bac2
Merge pull request #240 from Particular/attribute-support-for-transac…
SeanFeldman cd5171d
use single process implementation
timbussmann ae0b19f
delete comment
timbussmann 566b21e
Native message may not have a messageId
mikeminutillo 2c0d749
Extract transaction strategy
mikeminutillo b6c8700
use single process implementation
timbussmann 2def400
delete comment
timbussmann 8ec81e7
Native message may not have a messageId
mikeminutillo d47414e
add some unit tests around the Process implementation
timbussmann 27a7186
Extract transaction strategy
mikeminutillo 2f9e9db
Fix tests
mikeminutillo e1888ed
Merge branch 'extract-transaction-strategy' of https://github.com/Par…
mikeminutillo d42d229
Refactor
mikeminutillo f74c8dc
Merge pull request #243 from Particular/extract-transaction-strategy
mikeminutillo aeb893f
Auto-detect AutoComplete setting (#244)
timbussmann 0a5895f
Update src/NServiceBus.AzureFunctions.InProcess.ServiceBus/NServiceBu…
timbussmann 64e5453
use explicit interface impl. to hide Process on FunctionEndpoint
timbussmann 48aa83d
inline SafeCompleteAsync
timbussmann 942c089
update attribute property name
timbussmann f058b33
use existing function name
timbussmann df97eed
approve API changes
timbussmann 512fce2
Merge remote-tracking branch 'origin/master' into transactions
timbussmann cf58c4c
prevent potential NRE
timbussmann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
38 changes: 0 additions & 38 deletions
38
src/NServiceBus.AzureFunctions.InProcess.ServiceBus/AttributeDiscoverer.cs
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
src/NServiceBus.AzureFunctions.InProcess.ServiceBus/FodyWeavers.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Weavers GenerateXsd="false"> | ||
| <Obsolete /> | ||
| </Weavers> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/NServiceBus.AzureFunctions.InProcess.ServiceBus/NServiceBusTriggerFunctionAttribute.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| namespace NServiceBus | ||
| { | ||
| ///<summary> | ||
| /// Assembly attribute to configure generated NServiceBus Azure Function. | ||
| /// The attribute is used to wire up an auto-generated Service Bus trigger function, responding to messages in the queue specified by the name provided. | ||
| ///</summary> | ||
| [System.AttributeUsage(System.AttributeTargets.Assembly)] | ||
| public sealed class NServiceBusTriggerFunctionAttribute : System.Attribute | ||
| { | ||
| /// <summary> | ||
| /// Endpoint name that is the input queue name. | ||
| /// </summary> | ||
| public string EndpointName { get; } | ||
|
|
||
| /// <summary> | ||
| /// Override trigger function name. | ||
| /// </summary> | ||
| public string TriggerFunctionName { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Enable cross-entity transactions. | ||
| /// </summary> | ||
| public bool EnableCrossEntityTransactions { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Endpoint logical name. | ||
| /// </summary> | ||
| /// <param name="endpointName">Endpoint name that is the input queue name.</param> | ||
| public NServiceBusTriggerFunctionAttribute(string endpointName) | ||
| { | ||
| EndpointName = endpointName; | ||
| } | ||
| } | ||
| } |
50 changes: 50 additions & 0 deletions
50
src/NServiceBus.AzureFunctions.InProcess.ServiceBus/ReflectionHelper.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| namespace NServiceBus.AzureFunctions.InProcess.ServiceBus | ||
| { | ||
| using System; | ||
| using System.Diagnostics; | ||
| using System.Reflection; | ||
| using Microsoft.Azure.ServiceBus; | ||
| using Microsoft.Azure.WebJobs; | ||
|
|
||
| class ReflectionHelper | ||
| { | ||
| public static bool GetAutoCompleteValue() | ||
| { | ||
| var triggerAttribute = FindTriggerAttributeInternal(); | ||
| if (triggerAttribute != null) | ||
| { | ||
| return triggerAttribute.AutoComplete; | ||
| } | ||
|
|
||
| throw new Exception($"Could not locate {nameof(ServiceBusTriggerAttribute)} to infer the AutoComplete setting. Make sure that the function trigger contains a parameter decorated with {nameof(ServiceBusTriggerAttribute)} or use the advanced APIs exposed via the {nameof(FunctionEndpoint)} type instead."); | ||
| } | ||
|
|
||
| public static ServiceBusTriggerAttribute FindBusTriggerAttribute() => FindTriggerAttributeInternal(); | ||
|
|
||
| static ServiceBusTriggerAttribute FindTriggerAttributeInternal() | ||
| { | ||
| var st = new StackTrace(skipFrames: 2); // skip first two frames because it is this method + the public method | ||
| var frames = st.GetFrames(); | ||
| foreach (var frame in frames) | ||
| { | ||
| var method = frame?.GetMethod(); | ||
| if (method?.GetCustomAttribute<FunctionNameAttribute>(false) != null) | ||
| { | ||
| foreach (var parameter in method.GetParameters()) | ||
| { | ||
| ServiceBusTriggerAttribute serviceBusTriggerAttribute; | ||
| if (parameter.ParameterType == typeof(Message) | ||
| && (serviceBusTriggerAttribute = parameter.GetCustomAttribute<ServiceBusTriggerAttribute>(false)) != null) | ||
| { | ||
| return serviceBusTriggerAttribute; | ||
| } | ||
| } | ||
|
|
||
| return null; | ||
| } | ||
| } | ||
|
|
||
| return null; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/NServiceBus.AzureFunctions.InProcess.ServiceBus/Transactions/ITransactionStrategy.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| namespace NServiceBus | ||
| { | ||
| using System.Threading.Tasks; | ||
| using System.Transactions; | ||
| using Transport; | ||
|
|
||
| interface ITransactionStrategy | ||
| { | ||
| CommittableTransaction CreateTransaction(); | ||
| TransportTransaction CreateTransportTransaction(CommittableTransaction transaction); | ||
| Task Complete(CommittableTransaction transaction); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.