title: How do I use convertAndSendToUser() with an external broker such as RabbitMQ in Spring4?
body: <p>I am trying to configure web socket support in Spring 4 using RabbitMQ as the external broker, but as soon as I switch to RabbitMQ, I get the following error on start-up in the client:</p>
  
  <pre><code>'/user/queue/changes' is not a valid destination.
  Valid destination types are: /temp-queue, /exchange, /topic, /queue, /amq/queue, /reply-queue/.
  </code></pre>
  
  <p>On the server I am using <code>convertAndSendToUser</code> and this works fine with the simple broker, but as soon as I switch to RabbitMQ, I get this error.  Note that RabbitMQ works fine for normal topic broadcasts - it's just the <code>/user</code> channel that falls over.</p>
  
  <p>Do I need to do something special to get <code>/user</code> to work with RabbitMQ?  </p>
  
  <p><strong>Edit to include Web Socket Config</strong> </p>
  
  <p>My <code>WebSocketConfig</code> is pretty standard with a few customisations to integrate it with <a href="http://docs.spring.io/spring-session/docs/current-SNAPSHOT/reference/html5/guides/websocket.html" rel="noreferrer">spring-session</a>:</p>
  
  <pre><code>@Configuration
  @EnableWebSocketMessageBroker
  public class WebSocketConfig extends AbstractSessionWebSocketMessageBrokerConfigurer&lt;ExpiringSession&gt; {
  
  
  @Override
  public void configureStompEndpoints(StompEndpointRegistry registry) {
      registry.addEndpoint("/changes").withSockJS();
  }
  
  @Override
  public void configureMessageBroker(MessageBrokerRegistry config) {
      //config.enableSimpleBroker("/queue", "/topic");
      StompBrokerRelayRegistration r = config.enableStompBrokerRelay("/user", "/topic");
  
      try {
          String rabbitUrl = System.getenv("CLOUDAMQP_URL");
          if(rabbitUrl != null) { 
              log.info("RABBIT URL detected: " + rabbitUrl);
              URI uri = new URI(rabbitUrl);
              String host = uri.getHost();                
              String login = uri.getUserInfo().split(":",2)[0];
              String passCode = uri.getUserInfo().split(":",2)[1];
              String vhost = uri.getPath().substring(1);
              r.setRelayHost(host);
              r.setSystemLogin(login);    
              r.setSystemPasscode(passCode);
              r.setClientLogin(login);    
              r.setClientPasscode(passCode);
              r.setVirtualHost(vhost);                
          }
      } catch(Exception e) {
          log.error("Error setting up RabbitMQ", e);
      }
      config.setApplicationDestinationPrefixes("/app");
    }
  }
  </code></pre>