forked from hibernating-rhinos/rhino-esb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathISagaFinder.cs
49 lines (46 loc) · 1.8 KB
/
ISagaFinder.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using Rhino.ServiceBus.Internal;
using Rhino.ServiceBus.Sagas;
namespace Rhino.ServiceBus
{
/// <summary>
/// Defines a way to find sagas using messages that don't implement <see cref="ISagaMessage"/>.
/// This is useful for when one saga orchestrates messages returned by other consumers or sagas.
/// </summary>
/// <typeparam name="SagaT">The type of the saga to find</typeparam>
/// <typeparam name="MessageT">The message to use </typeparam>
public interface ISagaFinder<SagaT, MessageT> where SagaT : IAccessibleSaga
{
SagaT FindBy(MessageT message);
}
/// <summary>
/// Human readable way of defining a saga finder.
/// </summary>
/// <example>
/// public class MySagaFinder : FinderOf<SagaT>.By<MessageT>
/// {
/// public MySaga FindBy(SpecialMessage message)
/// {
/// //find sagas using the message here. Usually you will use an ISagaPersister to fetch sagas.
/// }
/// }
/// </example>
/// <typeparam name="SagaT">The type of the saga to find</typeparam>
public static class FinderOf<SagaT> where SagaT : IAccessibleSaga
{
/// <summary>
/// Human readable way of defining a saga finder.
/// </summary>
/// <example>
/// public class MySagaFinder : FinderOf<SagaT>.By<MessageT>
/// {
/// public MySaga FindBy(SpecialMessage message)
/// {
/// //find sagas using the message here. Usually you will use an ISagaPersister to fetch sagas.
/// }
/// }
/// </example>
/// <typeparam name="MessageT">The type of the message used to find sagas.</typeparam>
public interface By<MessageT> : ISagaFinder<SagaT, MessageT>
{}
}
}