!71 适配远程客户端

This commit is contained in:
Diego
2025-08-12 16:00:53 +00:00
parent 280366e1b2
commit 02ad494a26
181 changed files with 3484 additions and 1146 deletions

View File

@@ -26,7 +26,32 @@ public partial class KafkaProducer : BusinessBaseWithCacheIntervalScriptAll
public override VariablePropertyBase VariablePropertys => _variablePropertys;
protected override BusinessPropertyWithCacheIntervalScript _businessPropertyWithCacheIntervalScript => _driverPropertys;
private IProducer<Null, byte[]> _producer;
/// <inheritdoc/>
public override string ToString()
{
return $" {nameof(KafkaProducer)} :{_driverPropertys.BootStrapServers}";
}
/// <inheritdoc/>
protected override Task DisposeAsync(bool disposing)
{
try
{
_producer?.Flush(TimeSpan.FromSeconds(10));
}
catch
{
}
_producer?.SafeDispose();
return base.DisposeAsync(disposing);
}
#if !Management
protected override async Task InitChannelAsync(IChannel? channel, CancellationToken cancellationToken)
{
#region
@@ -66,28 +91,13 @@ public partial class KafkaProducer : BusinessBaseWithCacheIntervalScriptAll
/// <inheritdoc/>
public override bool IsConnected() => success;
/// <inheritdoc/>
public override string ToString()
{
return $" {nameof(KafkaProducer)} :{_driverPropertys.BootStrapServers}";
}
/// <inheritdoc/>
protected override Task DisposeAsync(bool disposing)
{
try
{
_producer?.Flush(TimeSpan.FromSeconds(10));
}
catch
{
}
_producer?.SafeDispose();
return base.DisposeAsync(disposing);
}
protected override Task ProtectedExecuteAsync(object? state, CancellationToken cancellationToken)
{
return Update(cancellationToken);
}
#endif
}

View File

@@ -23,7 +23,7 @@ namespace ThingsGateway.Plugin.Kafka;
/// </summary>
public partial class KafkaProducer : BusinessBaseWithCacheIntervalScriptAll
{
private IProducer<Null, byte[]> _producer;
#if !Management
private ProducerBuilder<Null, byte[]> _producerBuilder;
private ProducerConfig _producerconfig;
private volatile bool producerSuccess = true;
@@ -239,4 +239,7 @@ public partial class KafkaProducer : BusinessBaseWithCacheIntervalScriptAll
}
#endregion
#endif
}

View File

@@ -3,6 +3,7 @@
<Import Project="..\..\PackNuget.props" />
<PropertyGroup>
<TargetFrameworks>net8.0;</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Gateway\ThingsGateway.Gateway.Application\ThingsGateway.Gateway.Application.csproj">

View File

@@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\Version.props" />
<Import Project="..\..\PackNuget.props" />
<PropertyGroup>
<TargetFrameworks>net8.0;</TargetFrameworks>
<DefineConstants>$(DefineConstants);Management</DefineConstants>
<OutputPath>bin\$(Configuration)\Management\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\Management\$(TargetFramework)\</IntermediateOutputPath>
<PackageOutputPath>$(MSBuildThisFileDirectory)..\..\..\..\nupkgs1</PackageOutputPath>
</PropertyGroup>
<PropertyGroup>
<AssemblyName>ThingsGateway.Plugin.Kafka</AssemblyName>
<PackageId>$(MSBuildProjectName)</PackageId>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\PluginPro\ThingsGateway.Management.Razor\ThingsGateway.Management.Razor.csproj" />
<PackageReference Include="Confluent.Kafka" Version="2.11.0" GeneratePathProperty="true">
<PrivateAssets>contentFiles;compile;build;buildMultitargeting;buildTransitive;analyzers;</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Content Remove="Locales\*.json" />
<EmbeddedResource Include="Locales\*.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
</Project>