-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from alexvaluyskiy/feature/masstransit_metrics
MassTransit metrics
- Loading branch information
Showing
24 changed files
with
482 additions
and
111 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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,52 @@ | ||
using System; | ||
using Automatonymous; | ||
|
||
namespace WebApp.MassTransit | ||
{ | ||
public class OrderStateMachine : MassTransitStateMachine<OrderState> | ||
{ | ||
public OrderStateMachine() | ||
{ | ||
InstanceState(x => x.CurrentState); | ||
|
||
Event(() => SubmitOrder, x => x.CorrelateById(context => context.Message.OrderId)); | ||
Event(() => OrderAccepted, x => x.CorrelateById(context => context.Message.OrderId)); | ||
|
||
Initially( | ||
When(SubmitOrder) | ||
.TransitionTo(Submitted)); | ||
|
||
During(Submitted, | ||
When(OrderAccepted) | ||
.Then(context => | ||
{ | ||
}) | ||
.TransitionTo(Accepted) | ||
.Finalize()); | ||
} | ||
|
||
public Event<SubmitOrder> SubmitOrder { get; private set; } | ||
public Event<OrderAccepted> OrderAccepted { get; private set; } | ||
|
||
|
||
public State Submitted { get; private set; } | ||
public State Accepted { get; private set; } | ||
} | ||
|
||
public class OrderState : SagaStateMachineInstance | ||
{ | ||
public Guid CorrelationId { get; set; } | ||
public string CurrentState { get; set; } | ||
} | ||
|
||
public interface SubmitOrder | ||
{ | ||
Guid OrderId { get; } | ||
} | ||
|
||
public interface OrderAccepted | ||
{ | ||
Guid OrderId { get; } | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
samples/WebApp/Consumers/TestCommand.cs → samples/WebApp/MassTransit/TestCommand.cs
This file contains 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
using System; | ||
|
||
namespace WebApp.Consumers | ||
namespace WebApp.MassTransit | ||
{ | ||
public class TestCommand | ||
{ | ||
|
This file contains 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 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,48 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using MassTransit.Courier; | ||
|
||
namespace WebApp.MassTransit | ||
{ | ||
public class DownloadImageActivity : IActivity<DownloadImageArguments, DownloadImageLog> | ||
{ | ||
public async Task<ExecutionResult> Execute(ExecuteContext<DownloadImageArguments> context) | ||
{ | ||
return default; | ||
} | ||
|
||
public async Task<CompensationResult> Compensate(CompensateContext<DownloadImageLog> context) | ||
{ | ||
return default; | ||
} | ||
} | ||
|
||
public class FilterImageActivity : IActivity<FilterImageArguments, FilterImageLog> | ||
{ | ||
public async Task<ExecutionResult> Execute(ExecuteContext<FilterImageArguments> context) | ||
{ | ||
return default; | ||
} | ||
|
||
public async Task<CompensationResult> Compensate(CompensateContext<FilterImageLog> context) | ||
{ | ||
return default; | ||
} | ||
} | ||
|
||
public class FilterImageLog | ||
{ | ||
} | ||
|
||
public class FilterImageArguments | ||
{ | ||
} | ||
|
||
public class DownloadImageLog | ||
{ | ||
} | ||
|
||
public class DownloadImageArguments | ||
{ | ||
} | ||
} |
This file contains 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 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 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
Oops, something went wrong.