Como configurar o RabbitMQ como um serviço fornecido pelo usuário
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Este documento mostra como vincular um app a uma instância do RabbitMQ não listada no marketplace do Kf (incluindo o click-to-deploy no Marketplace do RabbitMQ com o Spring Cloud Foundry Connector). Isso faz com que as credenciais do RabbitMQ sejam injetadas no app, assim como a vinculação aos serviços sejam provisionadas pelos planos do Marketplace.
Antes de começar
Verifique se o RabbitMQ está instalado e acessível pelo cluster do Kf.
Verifique se o RabbitMQ já foi configurado para o app.
Verifique se você segmentou o Space que está executando o app.
Criar a instância fornecida pelo usuário
Para que o Kf vincule um app à instância do RabbitMQ, a variável de ambiente mínima tem que ser o URI (por exemplo, amqp://username:password@host:port/vhost?query). Outros pares de chave-valor poderão ser incluídos, se você quiser. A documentação do RabbitMQ pode ajudar na criação de uma string de URI. O exemplo a seguir deve ser suficiente para implantações básicas.
Reinicie o app para que as alterações entrem em vigor:
kfrestartapplication-name
É possível confirmar as novas variáveis de ambiente que estão sendo fornecidas ao app:
kfvcap-servicesapplication-name
Atualizar a instância fornecida pelo usuário
Se houver alterações no ambiente (por exemplo, atualização de senha ou host no URI ou o acréscimo de novos pares de chave-valor) que precisem ser transmitidas para qualquer app vinculado a ele, será possível atualizar a instância fornecida pelo usuário.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-09-04 UTC."],[],[],null,["# Setting Up RabbitMQ as a User-Provided Service\n\n| **Note:** You can leverage services that aren't listed in the marketplace by creating user-provided service instances that an App can bind to. Learn more about [user-provided services](../concepts/user-provided-services).\n\nThis document guides you through binding your App to a RabbitMQ instance not listed in the Kf marketplace (including [RabbitMQ click to deploy on Marketplace](https://console.cloud.google.com/marketplace/product/click-to-deploy-images/rabbitmq) with the Spring Cloud Foundry Connector. This results in the RabbitMQ credentials being injected into your App, just like binding to services provisioned through marketplace plans.\n\nBefore you begin\n================\n\n- Ensure you have RabbitMQ installed and accessible by your Kf cluster.\n- Ensure RabbitMQ has already been set up for your App.\n- Ensure you have targeted the Space running your App.\n\nCreate the user-provided instance\n=================================\n\nFor Kf to successfully bind an App to your RabbitMQ instance, the minimum environment variable is the URI (for example `amqp://username:password@host:port/vhost?query`). Additional key-value pairs may be included if desired. The [RabbitMQ documentation](https://www.rabbitmq.com/uri-spec.html) can help with creating a URI string. The following example should be sufficient for basic deployments. \n\n kf cups \u003cvar translate=\"no\"\u003eservice-instance-name\u003c/var\u003e -p '{\"uri\":\"amqp://\u003cvar translate=\"no\"\u003eusername\u003c/var\u003e:\u003cvar translate=\"no\"\u003epassword\u003c/var\u003e@\u003cvar translate=\"no\"\u003erabbitmq-host\u003c/var\u003e:\u003cvar translate=\"no\"\u003e5672\u003c/var\u003e\"}' -t \"rabbitmq\"\n\nBind your App\n=============\n\nNow that the user-provided service has been created, you can bind your App to the instance name: \n\n kf bind-service \u003cvar translate=\"no\"\u003eapplication-name\u003c/var\u003e \u003cvar translate=\"no\"\u003eservice-instance-name\u003c/var\u003e\n\nRestart your App to for the changes to take effect: \n\n kf restart \u003cvar translate=\"no\"\u003eapplication-name\u003c/var\u003e\n\nYou can confirm the new environment variables being provided to your App: \n\n kf vcap-services \u003cvar translate=\"no\"\u003eapplication-name\u003c/var\u003e\n\nUpdate the user-provided instance\n=================================\n\nIf there are changes to the environment (for example password or host update in the URI, or the addition of new key-value pairs) that need to be passed on to any App bound to it, you can update the user-provided instance. \n\n kf uups \u003cvar translate=\"no\"\u003eservice-instance-name\u003c/var\u003e -p '{\"uri\":\"\u003cvar translate=\"no\"\u003enew-uri\u003c/var\u003e\", \"\u003cvar translate=\"no\"\u003esome-new-key\u003c/var\u003e\": \"\u003cvar translate=\"no\"\u003esome-new-value\u003c/var\u003e\"}'\n\n**Note:** After updating environment the service, you must unbind then rebind the service to make the changes active in your App. \n\n kf unbind-service \u003cvar translate=\"no\"\u003eapplication-name\u003c/var\u003e \u003cvar translate=\"no\"\u003eservice-instance-name\u003c/var\u003e\n kf bind-service \u003cvar translate=\"no\"\u003eapplication-name\u003c/var\u003e \u003cvar translate=\"no\"\u003eservice-instance-name\u003c/var\u003e\n\nRelated documents\n=================\n\n- [VCAP_SERVICES](/migrate/kf/docs/2.2/how-to/app-runtime#vcapservices)\n- [Unbind service](../cli/kf-unbind-service)\n- [Delete service](../cli/kf-delete-service)"]]