File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 11__title__ = 'sage-utils'
2- __version__ = '0.2 .0'
2+ __version__ = '0.3 .0'
33__license__ = 'BSD'
44VERSION = __version__
Original file line number Diff line number Diff line change 1+ from sage_utils .amqp .base import AmqpWorker
2+ from sage_utils .amqp .clients import RpcAmqpClient
3+
4+
5+ class MicroserviceRegisterWorker (AmqpWorker ):
6+ REQUEST_QUEUE_NAME = "auth.microservices.register"
7+ REQUEST_EXCHANGE_NAME = "open-matchmaking.direct"
8+ RESPONSE_EXCHANGE_NAME = "open-matchmaking.responses.direct"
9+ CONTENT_TYPE = 'application/json'
10+
11+ def get_microservice_data (self , app ):
12+ raise NotImplementedError ("The `get_microservice_data(data)` method "
13+ "must be implemented." )
14+
15+ async def run (self , * args , ** kwargs ):
16+ client = RpcAmqpClient (
17+ self .app ,
18+ routing_key = self .REQUEST_QUEUE_NAME ,
19+ request_exchange = self .REQUEST_EXCHANGE_NAME ,
20+ response_queue = '' ,
21+ response_exchange = self .RESPONSE_EXCHANGE_NAME
22+ )
23+ response = await client .send (self .get_microservice_data (self .app ))
24+
25+ assert 'error' not in response .keys (), response ['error' ]
26+ assert 'content' in response .keys ()
27+ assert response ['content' ] == 'OK'
You can’t perform that action at this time.
0 commit comments