PDA

View Full Version : Virtual host problem



Mange
Jul 26th, 2010, 07:44 AM
I'm trying to use the new Spring amqp features to connect to a rabbitMQ-server. My problem is that the queue that I want to connect to is located under a different virtual host on the MQ-server instead of the default one. I can't find where I can set that up. I hoped there would be a setter-method or something for that somewhere, like setVirtualMachine(vm).

I assume I have to set that up, otherwise it should be impossible to know which queue I' trying to get data from if there were 2 different queues with the same name under 2 different virtual hosts.

Any input would be appreciated.

AmrMostafa
Jul 31st, 2010, 07:51 AM
Note that the connection factory (currently SingleConnectionFactory) has a constructor which accepts com.rabbitmq.client.ConnectionFactory, which has a setter for the vhost.

So you could initialize a com.rabbitmq.client.ConnectionFactory, setting its vhost (as well as the host, user and pass) to anything you want, and pass that to Spring AMQP's ConnectionFactory.

I've not tried that, but I imagine it would work.

Mark Fisher
Jul 31st, 2010, 05:59 PM
I've opened this issue for M2: https://jira.springsource.org/browse/AMQP-34

Please vote for it.

For now, the workaround described above sounds good (set the fully configured target ConnectionFactory instance which can be defined as its own 'bean').

Mark Fisher
Aug 2nd, 2010, 11:49 AM
The issue has been resolved on the trunk and will be included in the M2 release.

Mange
Aug 10th, 2010, 11:41 AM
That sounds great.