-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathMessageReceptionRegistration.cs
More file actions
55 lines (46 loc) · 1.47 KB
/
MessageReceptionRegistration.cs
File metadata and controls
55 lines (46 loc) · 1.47 KB
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
50
51
52
53
54
55
using System;
namespace Ev.ServiceBus.Abstractions;
public enum HandlerMode
{
Typed = 1,
Generic
}
public class MessageReceptionRegistration
{
public MessageReceptionRegistration(ClientOptions clientOptions, Type payloadType, Type handlerType)
{
Options = clientOptions;
PayloadType = payloadType;
HandlerType = handlerType;
PayloadTypeId = PayloadType.Name;
HandlerMode = HandlerMode.Typed;
}
public MessageReceptionRegistration(ClientOptions clientOptions, string payloadTypeId, Type handlerType)
{
Options = clientOptions;
PayloadType = null;
HandlerType = handlerType;
PayloadTypeId = payloadTypeId;
HandlerMode = HandlerMode.Generic;
}
/// <summary>
/// Settings of the underlying resource that will receive the messages.
/// </summary>
public ClientOptions Options { get; }
/// <summary>
/// The type the receiving message wil be deserialized into.
/// </summary>
public Type? PayloadType { get; }
/// <summary>
/// The class that will be resolved to process the incoming message.
/// </summary>
public Type HandlerType { get; }
/// <summary>
/// The unique identifier of this payload's type.
/// </summary>
public string PayloadTypeId { get; internal set; }
/// <summary>
/// The unique identifier of this payload's type.
/// </summary>
public HandlerMode HandlerMode { get; internal set; }
}