Skip to content

Commit

Permalink
Updated code after migrating to the latest release of sage-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
Relrin committed Apr 7, 2018
1 parent 11c1328 commit e536a81
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions strategist/app/workers/microservice_register.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,11 @@
from sage_utils.amqp.base import AmqpWorker
from sage_utils.amqp.clients import RpcAmqpClient
from sage_utils.amqp.workers import BaseRegisterWorker


class MicroserviceRegisterWorker(AmqpWorker):
REQUEST_QUEUE_NAME = "auth.microservices.register"
REQUEST_EXCHANGE_NAME = "open-matchmaking.direct"
RESPONSE_EXCHANGE_NAME = "open-matchmaking.responses.direct"
CONTENT_TYPE = 'application/json'
class MicroserviceRegisterWorker(BaseRegisterWorker):

def get_microservice_data(self, app):
return {
'name': self.app.config['SERVICE_NAME'],
'version': self.app.config['SERVICE_VERSION'],
'permissions': []
}

async def run(self, *args, **kwargs):
client = RpcAmqpClient(
self.app,
routing_key=self.REQUEST_QUEUE_NAME,
request_exchange=self.REQUEST_EXCHANGE_NAME,
response_queue='',
response_exchange=self.RESPONSE_EXCHANGE_NAME
)
response = await client.send(self.get_microservice_data(self.app))

assert 'error' not in response.keys(), response['error']
assert 'content' in response.keys()
assert response['content'] == 'OK'

0 comments on commit e536a81

Please sign in to comment.