-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated code after migrating to the latest release of sage-utils
- Loading branch information
Showing
1 changed file
with
2 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |