4
4
using az_appservice_dotnet . services . v1 ;
5
5
using az_appservice_dotnet . services . v1 . Blob ;
6
6
using az_appservice_dotnet . services . v1 . Blob . dependencies ;
7
+ using az_appservice_dotnet . services . v1 . ImageProcessing ;
8
+ using az_appservice_dotnet . services . v1 . Monitor ;
7
9
using az_appservice_dotnet . services . v1 . State ;
8
10
using az_appservice_dotnet . services . v1 . State . dependencies ;
9
11
using az_appservice_dotnet . services . v1 . UploadedFiles ;
@@ -19,12 +21,16 @@ public static async Task Main(string[] args)
19
21
builder . Services . AddSingleton < IBlobProvider , AzureBlobProvider > ( ) ;
20
22
builder . Services . AddSingleton < IPersistProcessingStateProvider , CosmosDbPersistProcessingStateProvider > ( ) ;
21
23
builder . Services . AddSingleton < IPublishProcessingStateProvider , AzureSbPublishProcessingStateProvider > ( ) ;
24
+ builder . Services . AddSingleton < ISubscribeProcessingStateProvider , AzureSbSubscribeProcessingStateProvider > ( ) ;
22
25
23
26
builder . Services . AddSingleton < IFileProviderService , FakeFileProviderService > ( ) ;
24
27
builder . Services . AddSingleton < IBlobService , BlobService > ( ) ;
25
28
builder . Services . AddSingleton < IProcessingStateService , ProcessingStateService > ( ) ;
29
+ builder . Services . AddSingleton < IStateMonitor , ConsoleMonitor > ( ) ;
30
+ builder . Services . AddSingleton < IImageProcessorService , NullImageProcessorService > ( ) ;
26
31
27
32
builder . Services . AddSingleton < ProducerService > ( ) ;
33
+ builder . Services . AddSingleton < ProcessorService > ( ) ;
28
34
29
35
var app = builder . Build ( ) ;
30
36
@@ -37,7 +43,20 @@ public static async Task Main(string[] args)
37
43
38
44
app . MapGroup ( "/1" )
39
45
. MapApi1 ( app ) ;
46
+
47
+ var monitorService = app . Services . GetService < IStateMonitor > ( ) ;
48
+ if ( monitorService == null )
49
+ {
50
+ throw new Exception ( "StateMonitor is not registered" ) ;
51
+ }
52
+ monitorService . StartStateMonitor ( ) ;
40
53
54
+ var processorService = app . Services . GetService < ProcessorService > ( ) ;
55
+ if ( processorService == null )
56
+ {
57
+ throw new Exception ( "ProcessorService is not registered" ) ;
58
+ }
59
+ processorService . StartWaitForImagesToProcess ( ) ;
41
60
await app . RunAsync ( ) ;
42
61
}
43
62
0 commit comments