Skip to content

Commit 5c70719

Browse files
Copilotiancooper
andauthored
[Chore] Clean Up XML Comments for V10 - Core Framework Documentation (BrighterCommand#3646)
* Initial plan * Improve XML documentation for core value types and enums Co-authored-by: iancooper <45537+iancooper@users.noreply.github.com> * Add missing license headers and improve request-reply documentation Co-authored-by: iancooper <45537+iancooper@users.noreply.github.com> * Improve documentation for RoutingKey and Subscription classes Co-authored-by: iancooper <45537+iancooper@users.noreply.github.com> * Improve ServiceActivator interface documentation and add missing license headers Co-authored-by: iancooper <45537+iancooper@users.noreply.github.com> * Complete XML documentation cleanup for core value types and enums Co-authored-by: iancooper <45537+iancooper@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: iancooper <45537+iancooper@users.noreply.github.com>
1 parent 5ece00a commit 5c70719

20 files changed

Lines changed: 540 additions & 206 deletions
Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,89 @@
1+
#region Licence
2+
/* The MIT License (MIT)
3+
Copyright © 2025 Ian Cooper <ian_hammond_cooper@yahoo.co.uk>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE. */
22+
23+
#endregion
24+
125
using System;
226
using System.Threading.Tasks;
327

428
namespace Paramore.Brighter.ServiceActivator
529
{
30+
/// <summary>
31+
/// Interface for a consumer that processes messages from a subscription.
32+
/// </summary>
33+
/// <remarks>
34+
/// Consumers represent individual worker instances that process messages from channels.
35+
/// They are managed by the dispatcher and can be started, stopped, and monitored.
36+
/// </remarks>
637
public interface IAmAConsumer : IDisposable
738
{
839
/// <summary>
9-
/// Gets or sets the name.
40+
/// Gets the name of this consumer.
1041
/// </summary>
11-
/// <value>The name.</value>
42+
/// <value>The <see cref="ConsumerName"/> identifying this consumer.</value>
1243
ConsumerName Name { get; }
1344

1445
/// <summary>
15-
/// What is the subscription that this Consumer is for
46+
/// Gets or sets the subscription that this Consumer is processing.
1647
/// </summary>
48+
/// <value>The <see cref="Subscription"/> being processed by this consumer.</value>
1749
Subscription Subscription { get; set; }
1850

1951
/// <summary>
20-
/// Gets the performer.
52+
/// Gets the performer that executes the message processing logic.
2153
/// </summary>
22-
/// <value>The performer.</value>
54+
/// <value>The <see cref="IAmAPerformer"/> responsible for message processing.</value>
2355
IAmAPerformer Performer { get; }
2456

2557
/// <summary>
26-
/// Gets or sets the state.
58+
/// Gets or sets the current state of the consumer.
2759
/// </summary>
28-
/// <value>The state.</value>
60+
/// <value>The <see cref="ConsumerState"/> indicating the current operational state.</value>
2961
ConsumerState State { get; set; }
3062

3163
/// <summary>
32-
/// Gets or sets the job.
64+
/// Gets or sets the background task running the consumer.
3365
/// </summary>
34-
/// <value>The job.</value>
66+
/// <value>The <see cref="Task"/> representing the consumer's background work, or null if not running.</value>
3567
Task? Job { get; set; }
3668

69+
/// <summary>
70+
/// Gets or sets the identifier for the background job.
71+
/// </summary>
72+
/// <value>The <see cref="int"/> job identifier.</value>
3773
int JobId { get; set; }
3874

3975
/// <summary>
40-
/// Opens the task queue and begin receiving messages.
76+
/// Opens the task queue and begins receiving messages.
4177
/// </summary>
78+
/// <remarks>
79+
/// This starts the consumer's background processing and begins consuming messages from the subscription.
80+
/// </remarks>
4281
void Open();
4382

4483
/// <summary>
45-
/// Shuts the task, which will not receive messages.
84+
/// Shuts down the task, which will stop receiving messages.
4685
/// </summary>
47-
/// <param name="subscriptionRoutingKey"></param>
86+
/// <param name="subscriptionRoutingKey">The <see cref="RoutingKey"/> of the subscription to shut down.</param>
4887
void Shut(RoutingKey subscriptionRoutingKey);
4988
}
5089
}

src/Paramore.Brighter.ServiceActivator/IAmAMessagePump.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,33 @@ namespace Paramore.Brighter.ServiceActivator
3030
/// <summary>
3131
/// Interface IAmAMessagePump
3232
/// The message pump reads <see cref="Message"/>s from a channel, translates them into a <see cref="Request"/>s and asks <see cref="CommandProcessor"/> to
33-
/// dispatch them to an <see cref="IHandleRequests"/>. It is classical message loop, and so should run until it receives an <see cref="MessageType.MT_QUIT"/>
33+
/// dispatch them to an <see cref="IHandleRequests"/>. It is a classical message loop, and so should run until it receives an <see cref="MessageType.MT_QUIT"/>
3434
/// message. Clients of the message pump need to add a <see cref="Message"/> with of type <see cref="MessageType.MT_QUIT"/> to the <see cref="Channel"/> to abort
3535
/// a loop once started. The <see cref="IAmAChannelSync"/> interface provides a <see cref="IAmAChannelSync.Stop"/> method for this.
3636
/// </summary>
37+
/// <remarks>
38+
/// Message pumps implement the Service Activator pattern and are responsible for the continuous processing
39+
/// of messages from messaging infrastructure like queues or streams.
40+
/// </remarks>
3741
public interface IAmAMessagePump
3842
{
3943
/// <summary>
40-
/// The <see cref="MessagePumpType"/> of this message pump; indicates Reactor or Proactor
44+
/// Gets the <see cref="MessagePumpType"/> of this message pump; indicates Reactor or Proactor.
4145
/// </summary>
46+
/// <value>A <see cref="MessagePumpType"/> indicating the type of message processing pattern used.</value>
4247
MessagePumpType MessagePumpType { get; }
4348

4449
/// <summary>
4550
/// Runs the message pump, performing the following:
4651
/// - Gets a message from a queue/stream
4752
/// - Translates the message to the local type system
4853
/// - Dispatches the message to waiting handlers
49-
/// - Handles any exceptions that occur during the dispatch and tries to keep the pump alive
54+
/// - Handles any exceptions that occur during the dispatch and tries to keep the pump alive
5055
/// </summary>
51-
/// <exception cref="Exception"></exception>
56+
/// <exception cref="Exception">Thrown when an unrecoverable error occurs during message processing.</exception>
57+
/// <remarks>
58+
/// This method will block and run continuously until a quit message is received or an unrecoverable error occurs.
59+
/// </remarks>
5260
void Run();
5361
}
5462
}

src/Paramore.Brighter.ServiceActivator/IDispatcher.cs

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,64 +32,76 @@ namespace Paramore.Brighter.ServiceActivator
3232
/// Interface IDispatcher
3333
/// The 'core' Service Activator class, the Dispatcher controls and co-ordinates the creation of readers from channels, and dispatching the commands and
3434
/// events translated from those messages to handlers. It controls the lifetime of the application through <see cref="Receive"/> and <see cref="End"/> and allows
35-
/// the stop and start of individual connections through <see cref="Open"/> and <see cref="Shut"/>
35+
/// the stop and start of individual connections through <see cref="Open"/> and <see cref="Shut"/>.
3636
/// </summary>
37+
/// <remarks>
38+
/// The Dispatcher implements the Service Activator pattern and coordinates multiple message pumps
39+
/// to process messages from different channels concurrently.
40+
/// </remarks>
3741
public interface IDispatcher
3842
{
3943
/// <summary>
40-
/// Gets the <see cref="Consumer"/>s
44+
/// Gets the <see cref="Consumer"/>s managed by this dispatcher.
4145
/// </summary>
42-
/// <value>The consumers.</value>
46+
/// <value>An <see cref="IEnumerable{T}"/> of <see cref="IAmAConsumer"/> instances.</value>
4347
IEnumerable<IAmAConsumer> Consumers { get; }
4448

4549
/// <summary>
4650
/// Gets or sets the name for this dispatcher instance.
47-
/// Used when communicating with this instance via the Control Bus
51+
/// Used when communicating with this instance via the Control Bus.
4852
/// </summary>
49-
/// <value>The name of the host.</value>
53+
/// <value>The <see cref="HostName"/> of the dispatcher instance.</value>
5054
HostName HostName { get; set; }
5155

5256
/// <summary>
53-
/// Ends this instance.
57+
/// Ends this dispatcher instance, stopping all message processing.
5458
/// </summary>
55-
/// <returns>Task.</returns>
59+
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
5660
Task End();
5761

5862
/// <summary>
59-
/// Opens the specified subscription.
63+
/// Opens the specified subscription for message processing.
6064
/// </summary>
61-
/// <param name="subscription">The subscription.</param>
65+
/// <param name="subscription">The <see cref="Subscription"/> to open.</param>
6266
void Open(Subscription subscription);
6367

6468
/// <summary>
65-
/// Opens the specified subscription name.
69+
/// Opens the specified subscription by name for message processing.
6670
/// </summary>
67-
/// <param name="subscriptionName"></param>
71+
/// <param name="subscriptionName">The <see cref="SubscriptionName"/> of the subscription to open.</param>
6872
void Open(SubscriptionName subscriptionName);
6973

7074
/// <summary>
7175
/// Begins listening for messages on channels, and dispatching them to request handlers.
7276
/// </summary>
77+
/// <remarks>
78+
/// This method will typically block and run continuously until <see cref="End"/> is called.
79+
/// </remarks>
7380
void Receive();
7481

7582
/// <summary>
76-
/// Shuts the specified subscription.
83+
/// Shuts down the specified subscription, stopping message processing for that subscription.
7784
/// </summary>
78-
/// <param name="subscription">The subscription.</param>
85+
/// <param name="subscription">The <see cref="Subscription"/> to shut down.</param>
7986
void Shut(Subscription subscription);
8087

8188
/// <summary>
82-
/// Shuts the specified subscription name.
89+
/// Shuts down the specified subscription by name, stopping message processing for that subscription.
8390
/// </summary>
84-
/// <param name="subscriptionName">Name of the subscription.</param>
91+
/// <param name="subscriptionName">The <see cref="SubscriptionName"/> of the subscription to shut down.</param>
8592
void Shut(SubscriptionName subscriptionName);
8693

8794
/// <summary>
88-
/// Get the current running state of the dispatcher
95+
/// Gets the current running state of the dispatcher.
8996
/// </summary>
90-
/// <returns>Array of all available subscriptions and how many are currency running</returns>
97+
/// <returns>An array of <see cref="DispatcherStateItem"/> showing all available subscriptions and how many are currently running.</returns>
9198
DispatcherStateItem[] GetState();
9299

100+
/// <summary>
101+
/// Sets the number of active performers for a specific connection.
102+
/// </summary>
103+
/// <param name="connectionName">The <see cref="string"/> name of the connection.</param>
104+
/// <param name="numberOfPerformers">The <see cref="int"/> number of performers to set.</param>
93105
void SetActivePerformers(string connectionName, int numberOfPerformers);
94106
}
95107
}

src/Paramore.Brighter/ChannelName.cs

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,20 @@ THE SOFTWARE. */
2525
namespace Paramore.Brighter
2626
{
2727
/// <summary>
28-
/// The name of a channel used to wrap communication with a Broker
28+
/// The name of a channel used to wrap communication with a Broker.
2929
/// </summary>
30+
/// <remarks>
31+
/// Channel names typically represent queue names or other addressing mechanisms
32+
/// used by messaging infrastructure to route messages.
33+
/// </remarks>
3034
public class ChannelName
3135
{
3236
private readonly string _name;
3337

3438
/// <summary>
3539
/// Initializes a new instance of the <see cref="ChannelName"/> class.
3640
/// </summary>
37-
/// <param name="name">The name.</param>
41+
/// <param name="name">The <see cref="string"/> name of the channel.</param>
3842
public ChannelName(string name)
3943
{
4044
_name = name;
@@ -43,46 +47,46 @@ public ChannelName(string name)
4347
/// <summary>
4448
/// Gets the name of the channel as a string.
4549
/// </summary>
46-
/// <value>The value.</value>
50+
/// <value>The <see cref="string"/> value of the channel name.</value>
4751
public string Value
4852
{
4953
get { return _name; }
5054
}
5155

5256
/// <summary>
53-
/// Returns a <see cref="System.String" /> that represents this instance.
57+
/// Returns a <see cref="string" /> that represents this instance.
5458
/// </summary>
55-
/// <returns>A <see cref="System.String" /> that represents this instance.</returns>
59+
/// <returns>A <see cref="string" /> containing the channel name.</returns>
5660
public override string ToString()
5761
{
5862
return _name;
5963
}
6064

6165
/// <summary>
62-
/// Performs an implicit conversion from <see cref="ChannelName"/> to <see cref="System.String"/>.
66+
/// Performs an implicit conversion from <see cref="ChannelName"/> to <see cref="string"/>.
6367
/// </summary>
64-
/// <param name="rhs">The RHS.</param>
65-
/// <returns>The result of the conversion.</returns>
68+
/// <param name="rhs">The <see cref="ChannelName"/> to convert.</param>
69+
/// <returns>The <see cref="string"/> result of the conversion.</returns>
6670
public static implicit operator string?(ChannelName rhs)
6771
{
6872
return rhs?.ToString();
6973
}
7074

7175
/// <summary>
72-
/// Performs an implicit conversion from <see cref="System.String"/> to <see cref="ChannelName"/>.
76+
/// Performs an implicit conversion from <see cref="string"/> to <see cref="ChannelName"/>.
7377
/// </summary>
74-
/// <param name="rhs">The RHS.</param>
75-
/// <returns>The result of the conversion.</returns>
78+
/// <param name="rhs">The <see cref="string"/> to convert.</param>
79+
/// <returns>The <see cref="ChannelName"/> result of the conversion.</returns>
7680
public static implicit operator ChannelName(string rhs)
7781
{
7882
return new ChannelName(rhs);
7983
}
8084

8185
/// <summary>
82-
/// Do the channel name's match?
86+
/// Determines whether the channel names match.
8387
/// </summary>
84-
/// <param name="other">The other.</param>
85-
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
88+
/// <param name="other">The other <see cref="ChannelName"/> to compare.</param>
89+
/// <returns><c>true</c> if the channel names are equal; otherwise, <c>false</c>.</returns>
8690
public bool Equals(ChannelName other)
8791
{
8892
if (ReferenceEquals(null, other)) return false;
@@ -91,10 +95,10 @@ public bool Equals(ChannelName other)
9195
}
9296

9397
/// <summary>
94-
/// Do the channel name's match?
98+
/// Determines whether the channel names match.
9599
/// </summary>
96-
/// <param name="obj">The object to compare with the current object.</param>
97-
/// <returns><c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.</returns>
100+
/// <param name="obj">The <see cref="object"/> to compare with the current object.</param>
101+
/// <returns><c>true</c> if the specified <see cref="object" /> is equal to this instance; otherwise, <c>false</c>.</returns>
98102
public override bool Equals(object? obj)
99103
{
100104
if (ReferenceEquals(null, obj)) return false;
@@ -113,27 +117,32 @@ public override int GetHashCode()
113117
}
114118

115119
/// <summary>
116-
/// Implements the ==. Do the channel name's match?
120+
/// Implements the == operator. Determines whether the channel names match.
117121
/// </summary>
118-
/// <param name="left">The left.</param>
119-
/// <param name="right">The right.</param>
120-
/// <returns>The result of the operator.</returns>
122+
/// <param name="left">The left <see cref="ChannelName"/>.</param>
123+
/// <param name="right">The right <see cref="ChannelName"/>.</param>
124+
/// <returns><c>true</c> if the channel names are equal; otherwise, <c>false</c>.</returns>
121125
public static bool operator ==(ChannelName left, ChannelName right)
122126
{
123127
return Equals(left, right);
124128
}
125129

126130
/// <summary>
127-
/// Implements the !=. Do the channel name's not match?
131+
/// Implements the != operator. Determines whether the channel names do not match.
128132
/// </summary>
129-
/// <param name="left">The left.</param>
130-
/// <param name="right">The right.</param>
131-
/// <returns>The result of the operator.</returns>
133+
/// <param name="left">The left <see cref="ChannelName"/>.</param>
134+
/// <param name="right">The right <see cref="ChannelName"/>.</param>
135+
/// <returns><c>true</c> if the channel names are not equal; otherwise, <c>false</c>.</returns>
132136
public static bool operator !=(ChannelName left, ChannelName right)
133137
{
134138
return !Equals(left, right);
135139
}
136140

141+
/// <summary>
142+
/// Determines whether the specified channel name is null or empty.
143+
/// </summary>
144+
/// <param name="channelName">The <see cref="ChannelName"/> to test.</param>
145+
/// <returns><c>true</c> if the channel name is null or empty; otherwise, <c>false</c>.</returns>
137146
public static bool IsNullOrEmpty(ChannelName? channelName)
138147
{
139148
return channelName is not null && string.IsNullOrEmpty(channelName._name);

0 commit comments

Comments
 (0)