Skip to content

Commit 35a62ab

Browse files
authored
API docs completed (#149)
* API docs completed * review changes
1 parent 53e5de8 commit 35a62ab

26 files changed

+776
-41
lines changed

src/Confluent.Kafka/BrokerMetadata.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,46 @@ namespace Confluent.Kafka
2323
/// </summary>
2424
public class BrokerMetadata
2525
{
26+
/// <summary>
27+
/// Initializes a new BrokerMetadata class instance.
28+
/// </summary>
29+
/// <param name="brokerId">
30+
/// The Kafka broker id.
31+
/// </param>
32+
/// <param name="host">
33+
/// The Kafka broker hostname.
34+
/// </param>
35+
/// <param name="port">
36+
/// The Kafka broker port.
37+
/// </param>
2638
public BrokerMetadata(int brokerId, string host, int port)
2739
{
2840
BrokerId = brokerId;
2941
Host = host;
3042
Port = port;
3143
}
3244

45+
/// <summary>
46+
/// Gets the Kafka broker id.
47+
/// </summary>
3348
public int BrokerId { get; }
49+
50+
/// <summary>
51+
/// Gets the Kafka broker hostname.
52+
/// </summary>
3453
public string Host { get; }
54+
55+
/// <summary>
56+
/// Gets the Kafka broker port.
57+
/// </summary>
3558
public int Port { get; }
3659

60+
/// <summary>
61+
/// Returns a JSON representation of the BrokerMetadata object.
62+
/// </summary>
63+
/// <returns>
64+
/// A JSON representation of the BrokerMetadata object.
65+
/// </returns>
3766
public override string ToString()
3867
=> $"{{ \"BrokerId\": {BrokerId}, \"Host\": \"{Host}\", \"Port\": {Port} }}";
3968
}

src/Confluent.Kafka/Error.cs

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ public class Error
2626
{
2727
/// <summary>
2828
/// Initialize a new Error instance from a particular
29-
/// ErrorCode value.
29+
/// <see cref="ErrorCode"/> value.
3030
/// </summary>
3131
/// <param name="code">
32-
/// The ErrorCode value associated with this Error.
32+
/// The <see cref="ErrorCode"/> value associated with this Error.
3333
/// </param>
3434
/// <remarks>
3535
/// The reason string associated with this Error will
36-
/// be a static value associated with the ErrorCode.
36+
/// be a static value associated with the <see cref="ErrorCode"/>.
3737
/// </remarks>
3838
public Error(ErrorCode code)
3939
{
@@ -43,11 +43,11 @@ public Error(ErrorCode code)
4343

4444
/// <summary>
4545
/// Initialize a new Error instance from a particular
46-
/// ErrorCode value and custom <paramref name="reason"/>
46+
/// <see cref="ErrorCode"/> value and custom <paramref name="reason"/>
4747
/// string.
4848
/// </summary>
4949
/// <param name="code">
50-
/// The ErrorCode value associated with this Error.
50+
/// The <see cref="ErrorCode"/> value associated with this Error.
5151
/// </param>
5252
/// <param name="reason">
5353
/// A custom reason string associated with the error
@@ -61,7 +61,7 @@ public Error(ErrorCode code, string reason)
6161
}
6262

6363
/// <summary>
64-
/// Gets the ErrorCode associated with this Error.
64+
/// Gets the <see cref="ErrorCode"/> associated with this Error.
6565
/// </summary>
6666
public ErrorCode Code { get; }
6767

@@ -93,15 +93,42 @@ public bool IsLocalError
9393
public bool IsBrokerError
9494
=> (int)Code > 0;
9595

96+
/// <summary>
97+
/// Converts the specified Error value to a boolean value (false if e.Code == ErrorCode.NoError, true otherwise).
98+
/// </summary>
99+
/// <param name="e">
100+
/// The Error value to convert.
101+
/// </param>
96102
public static implicit operator bool(Error e)
97103
=> e.HasError;
98104

105+
/// <summary>
106+
/// Converts the specified Error value to the value of it's Code property.
107+
/// </summary>
108+
/// <param name="e">
109+
/// The Error value to convert.
110+
/// </param>
99111
public static implicit operator ErrorCode(Error e)
100112
=> e.Code;
101113

114+
/// <summary>
115+
/// Converts the specified <see cref="ErrorCode"/> value to it's corresponding rich Error value.
116+
/// </summary>
117+
/// <param name="c">
118+
/// The <see cref="ErrorCode"/> value to convert.
119+
/// </param>
102120
public static implicit operator Error(ErrorCode c)
103121
=> new Error(c);
104122

123+
/// <summary>
124+
/// Tests whether this Error instance is equal to the specified object.
125+
/// </summary>
126+
/// <param name="obj">
127+
/// The object to test.
128+
/// </param>
129+
/// <returns>
130+
/// true if obj is an Error and the Code property values are equal. false otherwise.
131+
/// </returns>
105132
public override bool Equals(object obj)
106133
{
107134
if (!(obj is Error))
@@ -112,12 +139,42 @@ public override bool Equals(object obj)
112139
return ((Error)obj).Code == Code;
113140
}
114141

142+
/// <summary>
143+
/// Returns a hash code for this Error value.
144+
/// </summary>
145+
/// <returns>
146+
/// An integer that specifies a hash value for this Error value.
147+
/// </returns>
115148
public override int GetHashCode()
116149
=> Code.GetHashCode();
117150

151+
/// <summary>
152+
/// Tests whether Error value a is equal to Error value b.
153+
/// </summary>
154+
/// <param name="a">
155+
/// The first Error value to compare.
156+
/// </param>
157+
/// <param name="b">
158+
/// The second Error value to compare.
159+
/// </param>
160+
/// <returns>
161+
/// true if Error values a and b are equal. false otherwise.
162+
/// </returns>
118163
public static bool operator ==(Error a, Error b)
119164
=> a.Equals(b);
120165

166+
/// <summary>
167+
/// Tests whether Error value a is not equal to Error value b.
168+
/// </summary>
169+
/// <param name="a">
170+
/// The first Error value to compare.
171+
/// </param>
172+
/// <param name="b">
173+
/// The second Error value to compare.
174+
/// </param>
175+
/// <returns>
176+
/// true if Error values a and b are not equal. false otherwise.
177+
/// </returns>
121178
public static bool operator !=(Error a, Error b)
122179
=> !(a == b);
123180

@@ -127,6 +184,9 @@ public override int GetHashCode()
127184
/// contextual error message, or a simple static
128185
/// string representation of the error Code.
129186
/// </summary>
187+
/// <returns>
188+
/// A string representation of the Error object.
189+
/// </returns>
130190
public override string ToString()
131191
{
132192
// If a rich error string is available return that, otherwise fall

src/Confluent.Kafka/GroupInfo.cs

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,34 @@ namespace Confluent.Kafka
2727
/// </summary>
2828
public class GroupInfo
2929
{
30-
public GroupInfo(BrokerMetadata broker, string grp, Error error, string state, string protocolType, string protocol, List<GroupMemberInfo> members)
30+
/// <summary>
31+
/// Initializes a new instance of the GroupInfo class.
32+
/// </summary>
33+
/// <param name="broker">
34+
/// Originating broker info.
35+
/// </param>
36+
/// <param name="group">
37+
/// The group name.
38+
/// </param>
39+
/// <param name="error">
40+
/// A rich <see cref="Error"/> value associated with the information encapsulated by this class.
41+
/// </param>
42+
/// <param name="state">
43+
/// The group state.
44+
/// </param>
45+
/// <param name="protocolType">
46+
/// The group protocol type.
47+
/// </param>
48+
/// <param name="protocol">
49+
/// The group protocol.
50+
/// </param>
51+
/// <param name="members">
52+
/// The group members.
53+
/// </param>
54+
public GroupInfo(BrokerMetadata broker, string group, Error error, string state, string protocolType, string protocol, List<GroupMemberInfo> members)
3155
{
3256
Broker = broker;
33-
Group = grp;
57+
Group = group;
3458
Error = error;
3559
State = state;
3660
ProtocolType = protocolType;
@@ -39,37 +63,37 @@ public GroupInfo(BrokerMetadata broker, string grp, Error error, string state, s
3963
}
4064

4165
/// <summary>
42-
/// Originating-broker info.
66+
/// Gets the originating-broker info.
4367
/// </summary>
4468
public BrokerMetadata Broker { get; }
4569

4670
/// <summary>
47-
/// Group name
71+
/// Gets the group name
4872
/// </summary>
4973
public string Group { get; }
5074

5175
/// <summary>
52-
/// Broker-originated error
76+
/// Gets a rich <see cref="Error"/> value associated with the information encapsulated by this class.
5377
/// </summary>
5478
public Error Error { get; }
5579

5680
/// <summary>
57-
/// Group state
81+
/// Gets the group state
5882
/// </summary>
5983
public string State { get; }
6084

6185
/// <summary>
62-
/// Group protocol type
86+
/// Gets the group protocol type
6387
/// </summary>
6488
public string ProtocolType { get; }
6589

6690
/// <summary>
67-
/// Group protocol
91+
/// Gets the group protocol
6892
/// </summary>
6993
public string Protocol { get; }
7094

7195
/// <summary>
72-
/// Group members
96+
/// Gets the group members
7397
/// </summary>
7498
public List<GroupMemberInfo> Members { get; }
7599
}

src/Confluent.Kafka/GroupMemberInfo.cs

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,24 @@ namespace Confluent.Kafka
2424
/// </summary>
2525
public class GroupMemberInfo {
2626

27+
/// <summary>
28+
/// Initializes a new GroupMemberInfo class instance.
29+
/// </summary>
30+
/// <param name="memberId">
31+
/// The member id (generated by the broker).
32+
/// </param>
33+
/// <param name="clientId">
34+
/// The client's client.id.
35+
/// </param>
36+
/// <param name="clientHost">
37+
/// The client's hostname.
38+
/// </param>
39+
/// <param name="memberMetadata">
40+
/// Gets the member metadata (binary). The format of this data depends on the protocol type.
41+
/// </param>
42+
/// <param name="memberAssignment">
43+
/// Gets the member assignment (binary). The format of this data depends on the protocol type.
44+
/// </param>
2745
public GroupMemberInfo(string memberId, string clientId, string clientHost, byte[] memberMetadata, byte[] memberAssignment)
2846
{
2947
MemberId = memberId;
@@ -34,17 +52,17 @@ public GroupMemberInfo(string memberId, string clientId, string clientHost, byte
3452
}
3553

3654
/// <summary>
37-
/// Member id (generated by broker)
55+
/// Gets the member id (generated by broker).
3856
/// </summary>
3957
public string MemberId { get; }
4058

4159
/// <summary>
42-
/// Client's \p client.id
60+
/// Gets the client's client.id.
4361
/// </summary>
4462
public string ClientId { get; }
4563

4664
/// <summary>
47-
/// Client's hostname
65+
/// Gets the client's hostname.
4866
/// </summary>
4967
public string ClientHost { get; }
5068

@@ -53,12 +71,12 @@ public GroupMemberInfo(string memberId, string clientId, string clientHost, byte
5371
// we want? (probably I think)
5472

5573
/// <summary>
56-
/// Member metadata (binary), format depends on \p protocol_type.
74+
/// Gets the member metadata (binary). The format of this data depends on the protocol type.
5775
/// </summary>
5876
public byte[] MemberMetadata { get; }
5977

6078
/// <summary>
61-
/// Member assignment (binary), format depends on \p protocol_type.
79+
/// Gets the member assignment (binary). The format of this data depends on the protocol type.
6280
/// </summary>
6381
public byte[] MemberAssignment { get; }
6482
}

src/Confluent.Kafka/ISerializingProducer.cs

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
//
1515
// Refer to LICENSE for more information.
1616

17-
using System;
1817
using System.Threading.Tasks;
1918
using Confluent.Kafka.Serialization;
2019

@@ -43,14 +42,44 @@ public interface ISerializingProducer<TKey, TValue>
4342
/// </summary>
4443
ISerializer<TValue> ValueSerializer { get; }
4544

46-
Task<Message<TKey, TValue>> ProduceAsync(string topic, TKey key, TValue val);
45+
/// <summary>
46+
/// Refer to <see cref="Producer{TKey, TValue}.ProduceAsync(string, TKey, TValue)"/>.
47+
/// </summary>
48+
Task<Message<TKey, TValue>> ProduceAsync(string topic, TKey key, TValue val);
49+
50+
/// <summary>
51+
/// Refer to <see cref="Producer{TKey, TValue}.ProduceAsync(string, TKey, TValue, int, bool)"/>.
52+
/// </summary>
4753
Task<Message<TKey, TValue>> ProduceAsync(string topic, TKey key, TValue val, int partition, bool blockIfQueueFull);
54+
55+
/// <summary>
56+
/// Refer to <see cref="Producer{TKey, TValue}.ProduceAsync(string, TKey, TValue, int)"/>.
57+
/// </summary>
4858
Task<Message<TKey, TValue>> ProduceAsync(string topic, TKey key, TValue val, int partition);
59+
60+
/// <summary>
61+
/// Refer to <see cref="Producer{TKey, TValue}.ProduceAsync(string, TKey, TValue, bool)"/>.
62+
/// </summary>
4963
Task<Message<TKey, TValue>> ProduceAsync(string topic, TKey key, TValue val, bool blockIfQueueFull);
5064

65+
/// <summary>
66+
/// Refer to <see cref="Producer{TKey, TValue}.ProduceAsync(string, TKey, TValue, IDeliveryHandler{TKey, TValue})"/>.
67+
/// </summary>
5168
void ProduceAsync(string topic, TKey key, TValue val, IDeliveryHandler<TKey, TValue> deliveryHandler);
69+
70+
/// <summary>
71+
/// Refer to <see cref="Producer{TKey, TValue}.ProduceAsync(string, TKey, TValue, int, bool, IDeliveryHandler{TKey, TValue})"/>.
72+
/// </summary>
5273
void ProduceAsync(string topic, TKey key, TValue val, int partition, bool blockIfQueueFull, IDeliveryHandler<TKey, TValue> deliveryHandler);
74+
75+
/// <summary>
76+
/// Refer to <see cref="Producer{TKey, TValue}.ProduceAsync(string, TKey, TValue, int, IDeliveryHandler{TKey, TValue})"/>.
77+
/// </summary>
5378
void ProduceAsync(string topic, TKey key, TValue val, int partition, IDeliveryHandler<TKey, TValue> deliveryHandler);
79+
80+
/// <summary>
81+
/// Refer to <see cref="Producer{TKey, TValue}.ProduceAsync(string, TKey, TValue, bool, IDeliveryHandler{TKey, TValue})"/>.
82+
/// </summary>
5483
void ProduceAsync(string topic, TKey key, TValue val, bool blockIfQueueFull, IDeliveryHandler<TKey, TValue> deliveryHandler);
5584
}
5685
}

0 commit comments

Comments
 (0)