Results 1 to 5 of 5

Thread: Virtual host problem

  1. #1
    Join Date
    Jul 2010
    Posts
    9

    Default Virtual host problem

    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.

  2. #2
    Join Date
    Jul 2010
    Posts
    4

    Default

    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.

  3. #3
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,853

    Default

    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').

  4. #4
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,853

    Default

    The issue has been resolved on the trunk and will be included in the M2 release.

  5. #5
    Join Date
    Jul 2010
    Posts
    9

    Default

    That sounds great.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •