dev #2
@ -115,7 +115,7 @@ public class CollectBusApplicationModule : AbpModule
|
|||||||
|
|
||||||
foreach (var item in topics)
|
foreach (var item in topics)
|
||||||
{
|
{
|
||||||
kafkaAdminClient.CreateTopicIfNotExistAsync(item, configuration.GetValue<short>(CommonConst.KafkaReplicationFactor), configuration.GetValue<int>(CommonConst.NumPartitions));
|
kafkaAdminClient.CreateTopicAsync(item, configuration.GetValue<int>(CommonConst.NumPartitions), configuration.GetValue<short>(CommonConst.KafkaReplicationFactor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -95,6 +95,8 @@ namespace JiShe.CollectBus.ScheduledMeterReading
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//检查任务时间节点
|
||||||
|
|
||||||
//item 为 CacheTasksToBeIssuedKey 对应的缓存待下发的指令生产任务数据Redis Key tempArryay[0]=>CollectBus,tempArryay[1]=>SystemTypeConst,tempArryay[2]=>TaskInfo,tempArryay[3]=>表计类别,tempArryay[4]=>采集频率
|
//item 为 CacheTasksToBeIssuedKey 对应的缓存待下发的指令生产任务数据Redis Key tempArryay[0]=>CollectBus,tempArryay[1]=>SystemTypeConst,tempArryay[2]=>TaskInfo,tempArryay[3]=>表计类别,tempArryay[4]=>采集频率
|
||||||
var tempArryay = item.Split(":");
|
var tempArryay = item.Split(":");
|
||||||
string meteryType = tempArryay[3];//表计类别
|
string meteryType = tempArryay[3];//表计类别
|
||||||
|
|||||||
@ -27,14 +27,14 @@ namespace JiShe.CollectBus.Workers
|
|||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
RecurringJobId = nameof(CreateToBeIssueTaskWorker);
|
RecurringJobId = nameof(CreateToBeIssueTaskWorker);
|
||||||
CronExpression = $"*/{1} * * * *"; ;
|
CronExpression = $"{10}/* * * * *";
|
||||||
this._scheduledMeterReadingService = scheduledMeterReadingService;
|
this._scheduledMeterReadingService = scheduledMeterReadingService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken())
|
public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken())
|
||||||
{
|
{
|
||||||
//await _scheduledMeterReadingService.CreateToBeIssueTasks();
|
await _scheduledMeterReadingService.CreateToBeIssueTasks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,8 +71,12 @@ namespace JiShe.CollectBus.Kafka.AdminClient
|
|||||||
|
|
||||||
public async Task CreateTopicAsync(string topic, int numPartitions, short replicationFactor)
|
public async Task CreateTopicAsync(string topic, int numPartitions, short replicationFactor)
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (await CheckTopicAsync(topic)) return;
|
||||||
|
|
||||||
|
|
||||||
await Instance.CreateTopicsAsync(new[]
|
await Instance.CreateTopicsAsync(new[]
|
||||||
{
|
{
|
||||||
new TopicSpecification
|
new TopicSpecification
|
||||||
|
|||||||
@ -14,9 +14,9 @@ namespace JiShe.CollectBus.Kafka.Producer
|
|||||||
public class ProducerService<TKey, TValue> : IProducerService<TKey, TValue>, IDisposable,ITransientDependency
|
public class ProducerService<TKey, TValue> : IProducerService<TKey, TValue>, IDisposable,ITransientDependency
|
||||||
{
|
{
|
||||||
|
|
||||||
private readonly ILogger<ConsumerService<TKey, TValue>> _logger;
|
private readonly ILogger<ProducerService<TKey, TValue>> _logger;
|
||||||
|
|
||||||
protected ProducerService(IConfiguration configuration, ILogger<ConsumerService<TKey, TValue>> logger)
|
protected ProducerService(IConfiguration configuration, ILogger<ProducerService<TKey, TValue>> logger)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
GetInstance(configuration);
|
GetInstance(configuration);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user