def maestro_rabbitmq_service()

in src/services/service_provider.py [0:0]


        def maestro_rabbitmq_service(self):
            if not self.__maestro_rabbitmq_service:
                from modular_sdk.modular import Modular
                from modular_sdk.services.impl.maestro_rabbit_transport_service import \
                    MaestroRabbitConfig
                from modular_sdk.services.impl.maestro_credentials_service import \
                    RabbitMQCredentials, MaestroCredentialsService
                app_id = self.environment_service().get_rabbitmq_application_id()
                if not app_id:
                    return build_response(
                        code=RESPONSE_SERVICE_UNAVAILABLE_CODE,
                        content='The service is not configured correctly. '
                                'Please contact the support team.'
                    )
                application = self.rightsizer_application_service(). \
                    get_application_by_id(
                        application_id=app_id
                    )
                if not application:
                    return build_response(
                        code=RESPONSE_SERVICE_UNAVAILABLE_CODE,
                        content='The service is not configured correctly. '
                                'Please contact the support team.'
                    )
                modular = Modular()
                credentials_service = MaestroCredentialsService.build(
                    ssm_service=modular.ssm_service()
                )
                creds: RabbitMQCredentials = credentials_service.\
                    get_by_application(application)
                if not creds:
                    _LOG.error(f'Failed to get RabbitMQ credentials from '
                               f'application {application.application_id}.')
                    raise ApplicationException(
                        code=RESPONSE_SERVICE_UNAVAILABLE_CODE,
                        content=f'Failed to get RabbitMQ credentials from '
                                f'application {application.application_id}.'
                    )
                maestro_config = MaestroRabbitConfig(
                    request_queue=creds.request_queue,
                    response_queue=creds.response_queue,
                    rabbit_exchange=creds.rabbit_exchange,
                    sdk_access_key=creds.sdk_access_key,
                    sdk_secret_key=creds.sdk_secret_key,
                    maestro_user=creds.maestro_user
                )
                self.__maestro_rabbitmq_service = modular. \
                    rabbit_transport_service(
                        connection_url=creds.connection_url,
                        config=maestro_config
                )
            return self.__maestro_rabbitmq_service