add: интерфейсы брокера, сущности топиков брокера

This commit is contained in:
mfnefd 2024-11-13 03:32:30 +04:00
parent fbfde769b1
commit 1e2bd05667
7 changed files with 73 additions and 0 deletions

View File

@ -0,0 +1,7 @@
namespace Cloud.Services.Broker
{
public interface IBrokerConsumer
{
// TODO: добавить методы для получения данных
}
}

View File

@ -0,0 +1,9 @@
using Cloud.Services.Broker.Support;
namespace Cloud.Services.Broker
{
public interface IBrokerProdurcer
{
Task ProduceAsync(string topic, Command command);
}
}

View File

@ -0,0 +1,10 @@
using Cloud.Services.Broker.Support;
namespace Cloud.Services.Broker
{
public interface IBrokerService
{
Task<CommandResult> Produce(Command command);
Task<T> Consume<T>(string topic);
}
}

View File

@ -0,0 +1,17 @@
using Cloud.Services.Broker.Support;
namespace Cloud.Services.Broker.Implement.Kafka
{
public class KafkaService : IBrokerService
{
public Task<T> Consume<T>(string topic)
{
throw new NotImplementedException();
}
public Task<CommandResult> Produce(Command command)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,9 @@
namespace Cloud.Services.Broker.Support
{
public class Command
{
public int Id { get; set; }
public int GreenhouseId { get; set; }
public string CommandName { get; set; } = null!;
}
}

View File

@ -0,0 +1,9 @@
namespace Cloud.Services.Broker.Support
{
public class CommandResult
{
public int CommandId { get; set; }
public int GreenhouseId { get; set; }
public string ResultMessage { get; set; } = string.Empty;
}
}

View File

@ -0,0 +1,12 @@
namespace Cloud.Services.Broker.Support
{
public class GreenhouseInfo
{
public int Id { get; set; }
public int PercentWater { get; set; }
public int SoilTemperature { get; set; }
public bool PumpStatus { get; set; }
public bool HeatingStatus { get; set; }
public bool AutoWateringStatus { get; set; }
}
}