Monday, 15 July 2013

How to use Java RabbitMQ and set URI server? -


I am using RabbitMQ Java API to connect to the RabbitMQ server. I want to use the ConnectionFactory.setUri (...) to configure which server to use. It appears that the virtual host is merged.

/ is a default Virtual Host named.

  import com.rabbitmq.client.ConnectionFactory; Import com.rabbitmq.client.Connection; Import com.rabbitmq.client.Channel; Import java.net.URI; Public Work Worker {Public Fixed Zero Main (string [] argv throws exceptions {ConnectionFactory factory = New ConnectionFactory (); Final URI Uuri = URI.create ("amqp: // guest: localhost @ 5672 /"); Factory.setUri (URI); Last connection connection = factory.New connection (); Last channel channel = connection.createChannel (); }}   

Using the above code, the configured virtual host is empty. There is no way to use URI to configure virtual hosts that have / .

Is there any way to do this?

I am not using it as setUri but rather to individual URI components Setting up has ended.

No comments:

Post a Comment