-
Notifications
You must be signed in to change notification settings - Fork 10
/
function.delivery
37 lines (30 loc) · 1.1 KB
/
function.delivery
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
| hostname mongoPort mongo central jobs smscDatabaseName omDatabaseName |
hostname := 'localhost'.
self optionAt: 'db-host' ifPresent: [:dbHost |
hostname := dbHost].
mongoPort := 27017.
self optionAt: 'db-port' ifPresent: [:mongoPortString |
mongoPort := mongoPortString asNumber].
smscDatabaseName := 'smsc'.
self optionAt: 'smscdb-name' ifPresent: [:name |
smscDatabaseName := name].
omDatabaseName := 'smscOM'.
self optionAt: 'omdb-name' ifPresent: [:name |
omDatabaseName := name].
jobs := 10.
self optionAt: 'jobs' ifPresent: [:num |
jobs := num asInteger].
"Allow to have many Sockets and such"
Smalltalk vm maxExternalSemaphoresSilently: 512.
"Initialize the capped collection"
mongo := Mongo host: hostname port: mongoPort.
mongo open.
[
ShortMessageDatabase createInsertNotificationCollection: (mongo databaseNamed: smscDatabaseName).
] on: MongoCollectionAlreadyExists do: [].
mongo close.
"Start the inserter"
central := ShortMessageCenterDeliveryCentral new.
central
databaseHost: hostname port: mongoPort omName: omDatabaseName smscName: smscDatabaseName;
start: jobs.