-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #352 from LGouellec/reproducer/328
Fix issue 328
- Loading branch information
Showing
16 changed files
with
282 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
core/Processors/Internal/SequentiallyGracefullyShutdownHook.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System.Threading; | ||
using Microsoft.Extensions.Logging; | ||
using Streamiz.Kafka.Net.Crosscutting; | ||
|
||
namespace Streamiz.Kafka.Net.Processors.Internal | ||
{ | ||
internal class SequentiallyGracefullyShutdownHook | ||
{ | ||
private readonly IThread[] _streamThreads; | ||
private readonly GlobalStreamThread _globalStreamThread; | ||
private readonly IThread _externalStreamThread; | ||
private readonly CancellationTokenSource _tokenSource; | ||
private readonly ILogger log = Logger.GetLogger(typeof(SequentiallyGracefullyShutdownHook)); | ||
|
||
public SequentiallyGracefullyShutdownHook( | ||
IThread [] streamThreads, | ||
GlobalStreamThread globalStreamThread, | ||
IThread externalStreamThread, | ||
CancellationTokenSource tokenSource | ||
) | ||
{ | ||
_streamThreads = streamThreads; | ||
_globalStreamThread = globalStreamThread; | ||
_externalStreamThread = externalStreamThread; | ||
_tokenSource = tokenSource; | ||
} | ||
|
||
public void Shutdown() | ||
{ | ||
log.LogInformation($"Request shutdown gracefully"); | ||
_tokenSource.Cancel(); | ||
|
||
foreach (var t in _streamThreads) | ||
{ | ||
t.Dispose(); | ||
} | ||
|
||
_externalStreamThread?.Dispose(); | ||
_globalStreamThread?.Dispose(); | ||
|
||
log.LogInformation($"Shutdown gracefully successful"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"namespace": "ksql", | ||
"name": "product", | ||
"type": "record", | ||
"fields": [ | ||
{ | ||
"name": "category", | ||
"type": { | ||
"type": "string", | ||
"arg.properties": { | ||
"options": ["1", "2", "3"] | ||
} | ||
} | ||
}, | ||
{"name": "name", "type": { | ||
"type": "string", | ||
"arg.properties": { | ||
"iteration": { | ||
"start": 0 | ||
} | ||
} | ||
}}, | ||
{"name": "description", "type": { | ||
"type": "string", | ||
"arg.properties": { | ||
"iteration": { | ||
"start": 0 | ||
} | ||
} | ||
}}, | ||
{"name": "price", "type": { | ||
"type": "double", | ||
"arg.properties": { | ||
"iteration": { | ||
"start": 0 | ||
} | ||
} | ||
}} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,20 @@ | ||
#!/bin/bash | ||
|
||
curl -i -X PUT http://localhost:8083/connectors/datagen_local_01/config \ | ||
curl -i -X PUT http://localhost:8083/connectors/datagen_product/config \ | ||
-H "Content-Type: application/json" \ | ||
-d '{ | ||
"connector.class": "io.confluent.kafka.connect.datagen.DatagenConnector", | ||
"key.converter": "org.apache.kafka.connect.storage.StringConverter", | ||
"value.converter": "org.apache.kafka.connect.json.JsonConverter", | ||
"value.converter.schemas.enable": false, | ||
"kafka.topic": "shoes", | ||
"quickstart": "shoes", | ||
"max.interval": 100, | ||
"iterations": 10000000, | ||
"tasks.max": "1" | ||
}' | ||
"connector.class": "io.confluent.kafka.connect.datagen.DatagenConnector", | ||
"kafka.topic": "product3", | ||
"key.converter": "org.apache.kafka.connect.storage.StringConverter", | ||
"value.converter": "org.apache.kafka.connect.json.JsonConverter", | ||
"value.converter.schemas.enable": "false", | ||
"max.interval": 50, | ||
"iterations": 10000000, | ||
"tasks.max": "1", | ||
"schema.filename": "/home/appuser/order.avsc", | ||
"schema.keyfield": "name" | ||
}' | ||
|
||
curl -i -X PUT http://localhost:8083/connectors/datagen_local_02/config \ | ||
-H "Content-Type: application/json" \ | ||
-d '{ | ||
"connector.class": "io.confluent.kafka.connect.datagen.DatagenConnector", | ||
"key.converter": "org.apache.kafka.connect.storage.StringConverter", | ||
"value.converter": "org.apache.kafka.connect.json.JsonConverter", | ||
"value.converter.schemas.enable": false, | ||
"kafka.topic": "orders", | ||
"quickstart": "shoe_orders", | ||
"max.interval": 100, | ||
"iterations": 10000000, | ||
"tasks.max": "1" | ||
}' | ||
|
||
# curl -i -X PUT http://localhost:8083/connectors/datagen_product/pause | ||
# curl -i -X PUT http://localhost:8083/connectors/datagen_product/resume |
4 changes: 0 additions & 4 deletions
4
metrics/Streamiz.Kafka.Net.Metrics.OpenTelemetry/OpenTelemetryMetricsExporter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.