File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
src/allocation/entrypoints Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 2
2
import logging
3
3
import redis
4
4
5
- from allocation import config
5
+ from allocation import bootstrap , config
6
6
from allocation .domain import commands
7
- from allocation .adapters import orm
8
- from allocation .service_layer import messagebus , unit_of_work
9
7
10
8
logger = logging .getLogger (__name__ )
11
9
12
10
r = redis .Redis (** config .get_redis_host_and_port ())
13
11
14
12
13
+
15
14
def main ():
16
- orm . start_mappers ()
15
+ bus = bootstrap . bootstrap ()
17
16
pubsub = r .pubsub (ignore_subscribe_messages = True )
18
17
pubsub .subscribe ('change_batch_quantity' )
19
18
20
19
for m in pubsub .listen ():
21
- handle_change_batch_quantity (m )
20
+ handle_change_batch_quantity (m , bus )
22
21
23
22
24
- def handle_change_batch_quantity (m ):
23
+ def handle_change_batch_quantity (m , bus ):
25
24
logging .debug ('handling %s' , m )
26
25
data = json .loads (m ['data' ])
27
26
cmd = commands .ChangeBatchQuantity (ref = data ['batchref' ], qty = data ['qty' ])
28
- messagebus .handle (cmd , uow = unit_of_work . SqlAlchemyUnitOfWork () )
27
+ bus .handle (cmd )
29
28
30
29
31
30
if __name__ == '__main__' :
You can’t perform that action at this time.
0 commit comments