You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We deploy or applications on two different CF installations (pivotal and swisscom). The two are different in terms of how the rabbit credentials are defined in VCAP_SERVICES.
The rabbit credentials on pivotal only provide uri and http_api_uri in the credentials, where swisscom also provides things like the very important virtualhost (vhost). Although the virtual host ist also part of the uri on pivotal (last part of the uri), it is quite cumbersome to get hold of it. As a workaround we currently take advantage of the fact that virtualhost is equals to the username when the service is provided by cloudamqp on pivotal.
So our current config looks like this (we fallback to the username in case there is no vhost defined):
@Bean
public ConnectionFactory rabbit(CfEnv cfEnv) {
// "label" must match name of bound service on CF!
CfCredentials rabbitCredentials = cfEnv.findCredentialsByName("rabbit");
CachingConnectionFactory connectionFactory = new CachingConnectionFactory(rabbitCredentials.getHost(), Integer.parseInt(rabbitCredentials.getPort()));
connectionFactory.setChannelCacheSize(CHANNEL_CACHE_SIZE);
connectionFactory.setUsername(rabbitCredentials.getUsername());
connectionFactory.setPassword(rabbitCredentials.getPassword());
String vhost = StringUtils.isNotBlank(rabbitCredentials.getString("vhost")) ? rabbitCredentials.getString("vhost") : rabbitCredentials.getUsername();
connectionFactory.setVirtualHost(vhost);
return connectionFactory;
}
With this issue, I ask you to provide a more reliable way to access the virtualhost also in case where it is only configured in the uri (as in the case on run.pivotal.io). If not possible, I suggest to add some kind of documentation about this.
...btw, this did not make any difference with the old cloud connector api - everything was picked up automatically and was working fine.
VCAP_SERVICES details:
on run.pivotal.io, service provided by cloudamqp:
@imod Revisiting this issue, since the run.pivotal.io service is no longer active, is there any problem accessing the vhost on Swisscom or other providers?
We deploy or applications on two different CF installations (pivotal and swisscom). The two are different in terms of how the rabbit credentials are defined in
VCAP_SERVICES
.The rabbit credentials on pivotal only provide
uri
andhttp_api_uri
in the credentials, where swisscom also provides things like the very important virtualhost (vhost). Although the virtual host ist also part of theuri
on pivotal (last part of theuri
), it is quite cumbersome to get hold of it. As a workaround we currently take advantage of the fact that virtualhost is equals to the username when the service is provided by cloudamqp on pivotal.So our current config looks like this (we fallback to the
username
in case there is novhost
defined):With this issue, I ask you to provide a more reliable way to access the virtualhost also in case where it is only configured in the
uri
(as in the case on run.pivotal.io). If not possible, I suggest to add some kind of documentation about this....btw, this did not make any difference with the old cloud connector api - everything was picked up automatically and was working fine.
VCAP_SERVICES
details:on run.pivotal.io, service provided by cloudamqp:
swisscom, service provided by swisscom:
The text was updated successfully, but these errors were encountered: