add: интерфейсы брокера, сущности топиков брокера
This commit is contained in:
parent
fbfde769b1
commit
1e2bd05667
7
Cloud/Services/Broker/IBrokerConsumer.cs
Normal file
7
Cloud/Services/Broker/IBrokerConsumer.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace Cloud.Services.Broker
|
||||
{
|
||||
public interface IBrokerConsumer
|
||||
{
|
||||
// TODO: добавить методы для получения данных
|
||||
}
|
||||
}
|
9
Cloud/Services/Broker/IBrokerProdurcer.cs
Normal file
9
Cloud/Services/Broker/IBrokerProdurcer.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using Cloud.Services.Broker.Support;
|
||||
|
||||
namespace Cloud.Services.Broker
|
||||
{
|
||||
public interface IBrokerProdurcer
|
||||
{
|
||||
Task ProduceAsync(string topic, Command command);
|
||||
}
|
||||
}
|
10
Cloud/Services/Broker/IBrokerService.cs
Normal file
10
Cloud/Services/Broker/IBrokerService.cs
Normal 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);
|
||||
}
|
||||
}
|
17
Cloud/Services/Broker/Implement/Kafka/KafkaService.cs
Normal file
17
Cloud/Services/Broker/Implement/Kafka/KafkaService.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
9
Cloud/Services/Broker/Support/Command.cs
Normal file
9
Cloud/Services/Broker/Support/Command.cs
Normal 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!;
|
||||
}
|
||||
}
|
9
Cloud/Services/Broker/Support/CommandResult.cs
Normal file
9
Cloud/Services/Broker/Support/CommandResult.cs
Normal 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;
|
||||
}
|
||||
}
|
12
Cloud/Services/Broker/Support/GreenhouseInfo.cs
Normal file
12
Cloud/Services/Broker/Support/GreenhouseInfo.cs
Normal 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; }
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user