Skip to content
This repository was archived by the owner on Aug 4, 2023. It is now read-only.

Commit 6047e23

Browse files
committed
Analogy Kafka Data Provider
1 parent e386186 commit 6047e23

File tree

9 files changed

+62
-14
lines changed

9 files changed

+62
-14
lines changed

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,11 @@
88
/Analogy.Implementation.KafkaProvider.UnitTests/bin/Debug
99
/Analogy.Implementation.KafkaProvider.UnitTests/obj/Debug
1010
/packages
11+
/.vs/Analogy.LogViewer.KafkaProvider/DesignTimeBuild
12+
/Analogy.Implementation.KafkaProvider/bin/Release/netstandard2.0
13+
*.nupkg
14+
/Analogy.Implementation.KafkaProvider/nuget.exe
15+
/Analogy.Implementation.KafkaProvider.Example/bin
16+
/Analogy.Implementation.KafkaProvider.Example/obj
17+
/Analogy.Implementation.KafkaProvider.UnitTests/bin/Release
18+
/Analogy.Implementation.KafkaProvider.UnitTests/obj/Release
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<Version>0.1.1</Version>
6+
<Authors>Lior Banai</Authors>
7+
<Company>Lior Banai</Company>
8+
<Product>Analogy.Implementation.KafkaProvider</Product>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Analogy.LogViewer.Interfaces" Version="2.1.2" />
13+
<PackageReference Include="Confluent.Kafka" Version="1.2.1" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
17+
<ProjectReference Include="..\Analogy.Implementation.KafkaProvider\Analogy.Implementation.KafkaProvider.csproj" />
18+
</ItemGroup>
19+
20+
</Project>

Analogy.Implementation.KafkaProvider/Example/AnalogyKafkaExampleDataProvider.cs renamed to Analogy.Implementation.KafkaProvider.Example/AnalogyKafkaExampleDataProvider.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
42
using System.Threading.Tasks;
53
using Analogy.Interfaces;
64

7-
namespace Analogy.Implementation.KafkaProvider
5+
namespace Analogy.Implementation.KafkaProvider.Example
86
{
97
public class AnalogyKafkaExampleDataProvider : IAnalogyRealTimeDataProvider
108
{

Analogy.Implementation.KafkaProvider/Example/AnalogyKafkaExampleFactory.cs renamed to Analogy.Implementation.KafkaProvider.Example/AnalogyKafkaExampleFactory.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
using Analogy.Interfaces;
2-
using Analogy.Interfaces.Factories;
3-
using System;
1+
using System;
42
using System.Collections.Generic;
5-
using System.Text;
3+
using Analogy.Interfaces;
4+
using Analogy.Interfaces.Factories;
65

7-
namespace Analogy.Implementation.KafkaProvider
6+
namespace Analogy.Implementation.KafkaProvider.Example
87
{
9-
class AnalogyKafkaExampleFactory// : IAnalogyFactory
8+
class AnalogyKafkaExampleFactory : IAnalogyFactory
109
{
1110
public Guid FactoryID { get; } = Guid.Parse("CFE5834B-806A-4DB0-B36C-7E2C67DE2ECF");
1211
public string Title { get; } = "Analogy Kafka Example";

Analogy.Implementation.KafkaProvider/Example/TimerMessagesSimulator.cs renamed to Analogy.Implementation.KafkaProvider.Example/TimerMessagesSimulator.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Text;
42
using System.Timers;
53
using Analogy.Interfaces;
64

7-
namespace Analogy.Implementation.KafkaProvider
5+
namespace Analogy.Implementation.KafkaProvider.Example
86
{
97
public class TimerMessagesSimulator
108
{

Analogy.Implementation.KafkaProvider.UnitTests/CreationTests.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
using System;
22
using System.Collections.Generic;
33
using System.IO;
4+
using System.Linq;
45
using System.Reflection;
6+
using System.Threading.Tasks;
7+
using Analogy.Interfaces;
58
using Analogy.Interfaces.Factories;
69
using Microsoft.VisualStudio.TestTools.UnitTesting;
710

@@ -14,11 +17,19 @@ public class CreationTests
1417

1518

1619
[TestMethod]
17-
public void CreationTest()
20+
public async Task CreationTest()
1821
{
1922

2023
var factories = GetFactories();
2124
Assert.IsTrue(factories != null);
25+
26+
foreach (var d in factories.Last().DataProviders.Items)
27+
{
28+
d.InitDataProvider();
29+
(d as IAnalogyRealTimeDataProvider)?.StartReceiving();
30+
}
31+
32+
await Task.Delay(10000);
2233
}
2334

2435
private List<IAnalogyFactory> GetFactories()

Analogy.Implementation.KafkaProvider/KafkaConsumer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public KafkaConsumer(string groupId, string kafkaServerURL, string topic)
3030
{
3131
GroupId = groupId,
3232
BootstrapServers = KafkaServerURL,
33-
AutoOffsetReset = AutoOffsetReset.Earliest
33+
AutoOffsetReset = AutoOffsetReset.Earliest,
3434
};
3535

3636

Analogy.Implementation.KafkaProvider/KafkaProducer.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public KafkaProducer(string kafkaServerURL, string topic, KafkaSerializer<T> ser
2323
Config = new ProducerConfig
2424
{
2525
BootstrapServers = KafkaServerURL,
26+
MessageTimeoutMs = 5000
2627
};
2728
ReportHandler = r =>
2829
{

Analogy.LogViewer.KafkaProvider.sln

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Analogy.Implementation.Kafk
66
EndProject
77
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Analogy.Implementation.KafkaProvider.UnitTests", "Analogy.Implementation.KafkaProvider.UnitTests\Analogy.Implementation.KafkaProvider.UnitTests.csproj", "{6A9A54EE-2F10-4EC6-8340-E923AD027137}"
88
EndProject
9+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Analogy.Implementation.KafkaProvider.Example", "Analogy.Implementation.KafkaProvider.Example\Analogy.Implementation.KafkaProvider.Example.csproj", "{AEB13663-8261-46DB-923F-A9C51B05D7E9}"
10+
ProjectSection(ProjectDependencies) = postProject
11+
{512D664A-7F6F-412C-B47C-78C4F6D7BDAA} = {512D664A-7F6F-412C-B47C-78C4F6D7BDAA}
12+
EndProjectSection
13+
EndProject
914
Global
1015
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1116
Debug|Any CPU = Debug|Any CPU
@@ -30,6 +35,14 @@ Global
3035
{6A9A54EE-2F10-4EC6-8340-E923AD027137}.Release|Any CPU.Build.0 = Release|Any CPU
3136
{6A9A54EE-2F10-4EC6-8340-E923AD027137}.Release|x86.ActiveCfg = Release|Any CPU
3237
{6A9A54EE-2F10-4EC6-8340-E923AD027137}.Release|x86.Build.0 = Release|Any CPU
38+
{AEB13663-8261-46DB-923F-A9C51B05D7E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39+
{AEB13663-8261-46DB-923F-A9C51B05D7E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
40+
{AEB13663-8261-46DB-923F-A9C51B05D7E9}.Debug|x86.ActiveCfg = Debug|Any CPU
41+
{AEB13663-8261-46DB-923F-A9C51B05D7E9}.Debug|x86.Build.0 = Debug|Any CPU
42+
{AEB13663-8261-46DB-923F-A9C51B05D7E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
43+
{AEB13663-8261-46DB-923F-A9C51B05D7E9}.Release|Any CPU.Build.0 = Release|Any CPU
44+
{AEB13663-8261-46DB-923F-A9C51B05D7E9}.Release|x86.ActiveCfg = Release|Any CPU
45+
{AEB13663-8261-46DB-923F-A9C51B05D7E9}.Release|x86.Build.0 = Release|Any CPU
3346
EndGlobalSection
3447
GlobalSection(SolutionProperties) = preSolution
3548
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)