File tree 2 files changed +71
-0
lines changed
2 files changed +71
-0
lines changed Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using System . Collections . Generic ;
3
+ using System . IO ;
4
+ using System . Text ;
5
+ using Newtonsoft . Json ;
6
+
7
+ namespace Ingestion
8
+ {
9
+ public class IngestionService
10
+ {
11
+
12
+ private IList < IngestionSource > _sourcesList ;
13
+ private const string _sourcesConfigRelativePath = "config/ingestion_sources.json" ;
14
+
15
+ public IngestionService ( IList < IngestionSource > sources )
16
+ {
17
+ _sourcesList = sources ;
18
+ }
19
+
20
+ public IngestionService ( )
21
+ {
22
+ _sourcesList = LoadSourcesFromJson ( ) ;
23
+
24
+ }
25
+
26
+ // Due to sercurity concerns sources are either injected
27
+ //or loaded from config files
28
+ private IList < IngestionSource > LoadSourcesFromJson ( )
29
+ {
30
+ string json = "" ;
31
+
32
+ // deserialize JSON directly from a file
33
+ using ( StreamReader file = File . OpenText ( _sourcesConfigRelativePath ) )
34
+ {
35
+
36
+ }
37
+
38
+ List < string > videogames = JsonConvert . DeserializeObject < List < string > > ( json ) ;
39
+
40
+ Console . WriteLine ( string . Join ( ", " , videogames . ToArray ( ) ) ) ;
41
+ return null ;
42
+ }
43
+
44
+ public void Ingest ( int sourceID ) {
45
+ foreach ( IngestionSource source in _sourcesList ) {
46
+
47
+ }
48
+
49
+ PutInMessageQueue ( ) ;
50
+
51
+ }
52
+
53
+ private void PutInMessageQueue ( )
54
+ {
55
+ throw new NotImplementedException ( ) ;
56
+ }
57
+ }
58
+ }
Original file line number Diff line number Diff line change
1
+ using System ;
2
+ using System . Collections . Generic ;
3
+ using System . Text ;
4
+
5
+ namespace Ingestion
6
+ {
7
+ public class IngestionSource
8
+ {
9
+ public string ApiUrl { get ; set ; }
10
+ public string Credential { get ; set ; }
11
+ public string ForwardMessageQueue { get ; set ; }
12
+ }
13
+ }
You can’t perform that action at this time.
0 commit comments