Skip to content

Commit 9bb9893

Browse files
author
andrey.leskov
committed
Merge branch 'Scheduler'
2 parents 04c5273 + c319c57 commit 9bb9893

218 files changed

Lines changed: 2983 additions & 1180 deletions

File tree

Some content is hidden

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

GridDomain.CQRS.Messaging.Akka/TypedMessageActor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public TypedMessageActor(IActorRef actor)
1313

1414
public void Handle(T msg)
1515
{
16-
Actor.Ask(msg);
16+
Actor.Tell(msg);
1717
}
1818
}
1919
}

GridDomain.CQRS/CommandExecutorExtensions.cs

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,14 @@ namespace GridDomain.CQRS
77
{
88
public static class CommandExecutorExtensions
99
{
10-
public static Task<T> Execute<T>(this ICommandExecutor node, ICommand command, params ExpectedMessage[] expectedMessage)
10+
public static async Task<T> Execute<T>(this ICommandExecutor node, ICommand command, params ExpectedMessage[] expectedMessage)
1111
{
12-
return node.Execute(new CommandPlan<T>(command, expectedMessage));
12+
return await node.Execute(new CommandPlan<T>(command, expectedMessage));
1313
}
1414

15-
public static Task<T> Execute<T>(this ICommandExecutor node, ICommand command, ExpectedMessage<T> expectedMessage)
15+
public static async Task<T> Execute<T>(this ICommandExecutor node, ICommand command, ExpectedMessage<T> expectedMessage)
1616
{
17-
return node.Execute(CommandPlan.New(command, expectedMessage));
18-
}
19-
20-
public static T ExecuteSync<T>(this ICommandExecutor node, ICommand command, TimeSpan timeout, ExpectedMessage<T> expectedMessage)
21-
{
22-
return ExecuteSync(node, CommandPlan.New(command, timeout, expectedMessage));
23-
}
24-
25-
public static T ExecuteSync<T>(this ICommandExecutor node, CommandPlan<T> plan)
26-
{
27-
var task = node.Execute(plan);
28-
try
29-
{
30-
return task.Result;
31-
}
32-
catch (Exception ex)
33-
{
34-
ExceptionDispatchInfo.Capture(ex.UnwrapSingle()).Throw();
35-
}
36-
throw new InvalidOperationException();
17+
return await Execute<T>(node, command, new ExpectedMessage[]{expectedMessage});
3718
}
3819
}
3920
}

GridDomain.CQRS/CommandPlan.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class CommandPlan
2121

2222
public TimeSpan Timeout { get; }
2323
public CommandPlan(ICommand command, params ExpectedMessage[] expectedMessage)
24-
: this(command, TimeSpan.FromSeconds(10), expectedMessage)
24+
: this(command, TimeSpan.FromSeconds(10), expectedMessage)
2525
{
2626
}
2727

GridDomain.CQRS/GridDomain.CQRS.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,16 @@
6464
<Compile Include="ICommandExecutor.cs" />
6565
<Compile Include="ICommandHandler.cs" />
6666
<Compile Include="ICriteria.cs" />
67+
<Compile Include="IExpectBuilder.cs" />
68+
<Compile Include="IExpectedCommandExecutor.cs" />
6769
<Compile Include="IHandler.cs" />
6870
<Compile Include="IFault.cs" />
6971
<Compile Include="IMessageProcessFault.cs" />
7072
<Compile Include="IGenericQuery.cs" />
73+
<Compile Include="IMessageWaiter.cs" />
74+
<Compile Include="IMessageWaiterFactory.cs" />
7175
<Compile Include="IQuery.cs" />
76+
<Compile Include="IWaitResults.cs" />
7277
<Compile Include="Properties\AssemblyInfo.cs" />
7378
<Compile Include="ISingleQuery.cs" />
7479
</ItemGroup>

GridDomain.Node/AkkaMessaging/Waiting/IExpectBuilder.cs renamed to GridDomain.CQRS/IExpectBuilder.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
using System;
22

3-
namespace GridDomain.Node.AkkaMessaging.Waiting
3+
namespace GridDomain.CQRS
44
{
55
public interface IExpectBuilder<out T>
66
{
7-
T Create(TimeSpan? timeout = null);
7+
//T Create(TimeSpan timeout);
8+
T Create();
89
IExpectBuilder<T> And<TMsg>(Predicate<TMsg> filter = null);
910
IExpectBuilder<T> Or<TMsg>(Func<TMsg, bool> filter = null);
1011
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using System.Threading.Tasks;
2+
3+
namespace GridDomain.CQRS
4+
{
5+
public interface IExpectedCommandExecutor
6+
{
7+
Task<IWaitResults> Execute<T>(params T[] command) where T : ICommand;
8+
}
9+
}

GridDomain.CQRS/IMessageWaiter.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System;
2+
3+
namespace GridDomain.CQRS
4+
{
5+
public interface IMessageWaiter<T>
6+
{
7+
IExpectBuilder<T> Expect<TMsg>(Predicate<TMsg> filter = null);
8+
IExpectBuilder<T> Expect(Type type, Func<object, bool> filter = null);
9+
}
10+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
4+
namespace GridDomain.CQRS
5+
{
6+
public interface IMessageWaiterFactory
7+
{
8+
IMessageWaiter<Task<IWaitResults>> NewWaiter(TimeSpan? defaultTimeout = null);
9+
IMessageWaiter<IExpectedCommandExecutor> NewCommandWaiter(TimeSpan? defaultTimeout = null, bool failAnyFault = true);
10+
}
11+
}

GridDomain.Node/AkkaMessaging/Waiting/IWaitResults.cs renamed to GridDomain.CQRS/IWaitResults.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Collections.Generic;
22

3-
namespace GridDomain.Node.AkkaMessaging.Waiting
3+
namespace GridDomain.CQRS
44
{
55
public interface IWaitResults
66
{

GridDomain.Common/ExceptionExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public static Exception UnwrapSingle(this Exception exeption)
2222
return ex == null ? exeption : ex.UnwrapSingle();
2323
}
2424

25+
2526

2627
}
2728
}

0 commit comments

Comments
 (0)