docs: update the output of go and c# examples

This commit is contained in:
t_max 2024-08-16 15:22:18 +08:00
parent d6284424b6
commit 8c368a6fa6
4 changed files with 42 additions and 35 deletions

View File

@ -111,11 +111,12 @@ namespace TMQExample
catch (Exception e) catch (Exception e)
{ {
// handle other exceptions // handle other exceptions
Console.WriteLine($"Failed to create native consumer, " + Console.WriteLine(
$"host: {_host}, " + $"Failed to create native consumer, " +
$"groupId: {_groupId}, " + $"host: {_host}, " +
$"clientId: {_clientId}, " + $"groupId: {_groupId}, " +
$"ErrMessage: {e.Message}"); $"clientId: {_clientId}, " +
$"ErrMessage: {e.Message}");
throw; throw;
} }
@ -163,11 +164,12 @@ namespace TMQExample
catch (Exception e) catch (Exception e)
{ {
// handle other exceptions // handle other exceptions
Console.WriteLine($"Failed to poll data, " + Console.WriteLine(
$"topic: {_topic}, " + $"Failed to poll data, " +
$"groupId: {_groupId}, " + $"topic: {_topic}, " +
$"clientId: {_clientId}, " + $"groupId: {_groupId}, " +
$"ErrMessage: {e.Message}"); $"clientId: {_clientId}, " +
$"ErrMessage: {e.Message}");
throw; throw;
} }
// ANCHOR_END: subscribe // ANCHOR_END: subscribe
@ -186,13 +188,14 @@ namespace TMQExample
{ {
consumer.Seek(new TopicPartitionOffset(topicPartition.Topic, topicPartition.Partition, 0)); consumer.Seek(new TopicPartitionOffset(topicPartition.Topic, topicPartition.Partition, 0));
} }
Console.WriteLine("Assignment seek to beginning successfully"); Console.WriteLine("Assignment seek to beginning successfully");
} }
catch (TDengineError e) catch (TDengineError e)
{ {
// handle TDengine error // handle TDengine error
Console.WriteLine( Console.WriteLine(
$"Failed to execute seek example, " + $"Failed to seek offset, " +
$"topic: {_topic}, " + $"topic: {_topic}, " +
$"groupId: {_groupId}, " + $"groupId: {_groupId}, " +
$"clientId: {_clientId}, " + $"clientId: {_clientId}, " +
@ -204,12 +207,13 @@ namespace TMQExample
catch (Exception e) catch (Exception e)
{ {
// handle other exceptions // handle other exceptions
Console.WriteLine($"Failed to execute seek example, " + Console.WriteLine(
$"topic: {_topic}, " + $"Failed to seek offset, " +
$"groupId: {_groupId}, " + $"topic: {_topic}, " +
$"clientId: {_clientId}, " + $"groupId: {_groupId}, " +
$"offset: 0, " + $"clientId: {_clientId}, " +
$"ErrMessage: {e.Message}"); $"offset: 0, " +
$"ErrMessage: {e.Message}");
throw; throw;
} }
// ANCHOR_END: seek // ANCHOR_END: seek
@ -240,7 +244,7 @@ namespace TMQExample
{ {
// handle TDengine error // handle TDengine error
Console.WriteLine( Console.WriteLine(
$"Failed to execute commit example, " + $"Failed to commit offset, " +
$"topic: {_topic}, " + $"topic: {_topic}, " +
$"groupId: {_groupId}, " + $"groupId: {_groupId}, " +
$"clientId: {_clientId}, " + $"clientId: {_clientId}, " +
@ -253,7 +257,7 @@ namespace TMQExample
{ {
// handle other exceptions // handle other exceptions
Console.WriteLine( Console.WriteLine(
$"Failed to execute commit example, " + $"Failed to commit offset, " +
$"topic: {_topic}, " + $"topic: {_topic}, " +
$"groupId: {_groupId}, " + $"groupId: {_groupId}, " +
$"clientId: {_clientId}, " + $"clientId: {_clientId}, " +

View File

@ -116,11 +116,12 @@ namespace TMQExample
catch (Exception e) catch (Exception e)
{ {
// handle other exceptions // handle other exceptions
Console.WriteLine($"Failed to create native consumer, " + Console.WriteLine(
$"host: {_host}, " + $"Failed to create native consumer, " +
$"groupId: {_groupId}, " + $"host: {_host}, " +
$"clientId: {_clientId}, " + $"groupId: {_groupId}, " +
$"ErrMessage: {e.Message}"); $"clientId: {_clientId}, " +
$"ErrMessage: {e.Message}");
throw; throw;
} }
@ -191,13 +192,14 @@ namespace TMQExample
{ {
consumer.Seek(new TopicPartitionOffset(topicPartition.Topic, topicPartition.Partition, 0)); consumer.Seek(new TopicPartitionOffset(topicPartition.Topic, topicPartition.Partition, 0));
} }
Console.WriteLine("Assignment seek to beginning successfully"); Console.WriteLine("Assignment seek to beginning successfully");
} }
catch (TDengineError e) catch (TDengineError e)
{ {
// handle TDengine error // handle TDengine error
Console.WriteLine( Console.WriteLine(
$"Failed to execute seek example, " + $"Failed to seek offset, " +
$"topic: {_topic}, " + $"topic: {_topic}, " +
$"groupId: {_groupId}, " + $"groupId: {_groupId}, " +
$"clientId: {_clientId}, " + $"clientId: {_clientId}, " +
@ -209,12 +211,13 @@ namespace TMQExample
catch (Exception e) catch (Exception e)
{ {
// handle other exceptions // handle other exceptions
Console.WriteLine($"Failed to execute seek example, " + Console.WriteLine(
$"topic: {_topic}, " + $"Failed to seek offset, " +
$"groupId: {_groupId}, " + $"topic: {_topic}, " +
$"clientId: {_clientId}, " + $"groupId: {_groupId}, " +
$"offset: 0, " + $"clientId: {_clientId}, " +
$"ErrMessage: {e.Message}"); $"offset: 0, " +
$"ErrMessage: {e.Message}");
throw; throw;
} }
// ANCHOR_END: seek // ANCHOR_END: seek
@ -245,7 +248,7 @@ namespace TMQExample
{ {
// handle TDengine error // handle TDengine error
Console.WriteLine( Console.WriteLine(
$"Failed to execute commit example, " + $"Failed to commit offset, " +
$"topic: {_topic}, " + $"topic: {_topic}, " +
$"groupId: {_groupId}, " + $"groupId: {_groupId}, " +
$"clientId: {_clientId}, " + $"clientId: {_clientId}, " +
@ -258,7 +261,7 @@ namespace TMQExample
{ {
// handle other exceptions // handle other exceptions
Console.WriteLine( Console.WriteLine(
$"Failed to execute commit example, " + $"Failed to commit offset, " +
$"topic: {_topic}, " + $"topic: {_topic}, " +
$"groupId: {_groupId}, " + $"groupId: {_groupId}, " +
$"clientId: {_clientId}, " + $"clientId: {_clientId}, " +

View File

@ -112,7 +112,7 @@ func main() {
}, 0) }, 0)
if err != nil { if err != nil {
log.Fatalf( log.Fatalf(
"Failed to execute seek example, topic: %s, groupId: %s, clientId: %s, partition: %d, offset: %d, ErrMessage: %s\n", "Failed to execute seek offset, topic: %s, groupId: %s, clientId: %s, partition: %d, offset: %d, ErrMessage: %s\n",
topic, topic,
groupID, groupID,
clientID, clientID,

View File

@ -130,7 +130,7 @@ func main() {
}, 0) }, 0)
if err != nil { if err != nil {
log.Fatalf( log.Fatalf(
"Failed to execute seek example, topic: %s, groupId: %s, clientId: %s, partition: %d, offset: %d, ErrMessage: %s\n", "Failed to seek offset, topic: %s, groupId: %s, clientId: %s, partition: %d, offset: %d, ErrMessage: %s\n",
topic, topic,
groupID, groupID,
clientID, clientID,