.net7, and topic lister will also create them
All checks were successful
gitea/franz/pipeline/head This commit looks good
All checks were successful
gitea/franz/pipeline/head This commit looks good
This commit is contained in:
parent
5e78f52f0d
commit
e1ff1db122
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -10,7 +10,7 @@
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
// If you have changed target frameworks, make sure to update the program path.
|
||||
"program": "${workspaceFolder}/franz.tests/bin/Debug/net6.0/franz.tests.dll",
|
||||
"program": "${workspaceFolder}/franz.tests/bin/Debug/net7.0/franz.tests.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/franz.tests",
|
||||
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
|
||||
|
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
@ -1,7 +1,7 @@
|
||||
pipeline {
|
||||
agent any
|
||||
tools {
|
||||
dotnetsdk 'dotnet6'
|
||||
dotnetsdk 'dotnet7'
|
||||
}
|
||||
stages {
|
||||
stage('build franz') {
|
||||
|
@ -9,7 +9,7 @@ namespace franz.tests
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello World, I'm " + Dns.GetHostName());
|
||||
Telefranz.Configure("tester", "alloces:9092", new System.Collections.Generic.List<string>(){"a!"});
|
||||
Telefranz.Configure("tester", "alloces.lan:9092", new System.Collections.Generic.List<string>(){"a!"});
|
||||
|
||||
Console.WriteLine("telefranz configured");
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -104,6 +104,7 @@ namespace franz
|
||||
{
|
||||
config = new ConsumerConfig
|
||||
{
|
||||
AllowAutoCreateTopics = true,
|
||||
BootstrapServers = bootstrap_servers,
|
||||
GroupId = name,
|
||||
AutoOffsetReset = AutoOffsetReset.Earliest
|
||||
|
@ -1,14 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<PackageId>greyn.franz</PackageId>
|
||||
<Version>2.0.1</Version>
|
||||
<Version>2.1.0</Version>
|
||||
<Authors>Adam R Grey</Authors>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Confluent.Kafka" Version="1.9.3" />
|
||||
<PackageReference Include="Confluent.Kafka" Version="2.0.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -1,14 +1,23 @@
|
||||
using franz;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
using Confluent.Kafka;
|
||||
using Confluent.Kafka.Admin;
|
||||
|
||||
namespace topiclister
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
static async Task Main(string[] args)
|
||||
{
|
||||
Telefranz.Configure("shut up", "localhost:9092");
|
||||
try{
|
||||
var ignoreme = Telefranz.Instance ;
|
||||
}
|
||||
catch(NotInitializedException)
|
||||
{
|
||||
//gulp, mmm
|
||||
}
|
||||
var listOfBs = AppDomain.CurrentDomain.GetAssemblies()
|
||||
.SelectMany(domainAssembly => domainAssembly.GetTypes())
|
||||
.Where(type => type.IsSubclassOf(typeof(gray_messages.message)) && !type.IsAbstract)
|
||||
@ -16,15 +25,28 @@ namespace topiclister
|
||||
|
||||
if (listOfBs != null && listOfBs.Any())
|
||||
{
|
||||
foreach (var b in listOfBs)
|
||||
using (var adminClient = new AdminClientBuilder(new AdminClientConfig { BootstrapServers = "alloces.lan:9092" }).Build())
|
||||
{
|
||||
Console.WriteLine(b);
|
||||
foreach (var b in listOfBs)
|
||||
{
|
||||
Console.WriteLine(b.ToString());
|
||||
try
|
||||
{
|
||||
await adminClient.CreateTopicsAsync(new TopicSpecification[] {
|
||||
new TopicSpecification { Name = b.ToString(), ReplicationFactor = 1, NumPartitions = 1, } });
|
||||
}
|
||||
catch (CreateTopicsException e)
|
||||
{
|
||||
Console.WriteLine($"An error occured creating topic {e.Results[0].Topic}: {e.Results[0].Error.Reason}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(":(");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -6,7 +6,10 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Confluent.Kafka" Version="2.0.2" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user