-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
52 lines (34 loc) · 1.32 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import 'reflect-metadata';
import { TEST_ACTOR, TestActorImpl } from './actors/test-actor';
import { BaseApplicationConfigurationProvider } from '../../core/application/application-configuration-provider';
import { ConfigurableApplicationFactory } from '../../core/application/application-factory';
import { SWF } from 'aws-sdk';
import { TEST_WORKFLOW, TestWorkflowImpl } from './workflows/test-workflow';
import { ApplicationConfiguration } from '../../core/application/application-configuration';
import { MyApp } from './app';
const swf = new SWF({ region: 'us-east-1' });
const config = new ApplicationConfiguration(swf);
const configProvider = new BaseApplicationConfigurationProvider(config);
const applicationFactory = new ConfigurableApplicationFactory(configProvider);
applicationFactory.addImplementations([
{
impl: TestActorImpl,
key: TEST_ACTOR,
},
{
impl: TestWorkflowImpl,
key: TEST_WORKFLOW,
},
]);
async function boot() {
const app = applicationFactory.createApplication<MyApp>(MyApp);
const wworker = app.createWorker();
const aworker = app.createActorWorker();
await wworker.register().toPromise();
await aworker.register().toPromise();
wworker.startWorker();
aworker.startWorker();
const res = await app.start();
console.log(res);
}
boot().catch(err => console.error(err));