Configurer RabbitMQ en tant que service fourni par l'utilisateur
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Ce document vous guide à travers la procédure d'association de votre application à une instance RabbitMQ non répertoriée sur la place de marché Kf (y compris pour RabbitMQ en déploiement par clic sur la place de marché avec le connecteur Spring Cloud Foundry). Ainsi, les identifiants RabbitMQ sont injectés dans votre application, comme en cas d'association aux services provisionnés via des forfaits de place de marché.
Avant de commencer
Vérifiez que RabbitMQ est installé et accessible par votre cluster Kf.
Vérifiez que RabbitMQ a déjà été configuré pour votre application.
Assurez-vous d'avoir ciblé l'espace qui exécute votre application.
Créer l'instance fournie par l'utilisateur
Pour que Kf puisse associer une application à votre instance RabbitMQ, la variable d'environnement minimale est l'URI (par exemple, amqp://username:password@host:port/vhost?query). Des paires clé-valeur supplémentaires peuvent être incluses si vous le souhaitez. La documentation de RabbitMQ peut vous aider à créer une chaîne URI. L'exemple suivant devrait suffire pour les déploiements de base.
Redémarrez votre application pour que les modifications prennent effet :
kfrestartapplication-name
Vous pouvez confirmer les nouvelles variables d'environnement fournies à votre application :
kfvcap-servicesapplication-name
Mettre à jour l'instance fournie par l'utilisateur
Si des modifications sont apportées à l'environnement (par exemple, la mise à jour du mot de passe ou de l'hôte dans l'URI, ou l'ajout de nouvelles paires clé-valeur) et doivent être transmises aux applications liées, vous pouvez mettre à jour l'instance fournie par l'utilisateur.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 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\nRelated documents\n=================\n\n- [VCAP_SERVICES](/migrate/kf/docs/2.5/how-to/app-runtime#vcapservices)\n- [Unbind service](../cli/kf-unbind-service)\n- [Delete service](../cli/kf-delete-service)"]]