Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. @Bean
  2. public CachingConnectionFactory subscriberConnectionFactory() {
  3. CachingConnectionFactory subsCachingConnectionFactory = new CachingConnectionFactory();
  4. subsCachingConnectionFactory.setAddresses(rabbitMqConfig.getSubscriberAddresses()); // host1:port, host2:port
  5. subsCachingConnectionFactory.setUsername(rabbitMqConfig.getSubscriberUsername());
  6. subsCachingConnectionFactory.setPassword(rabbitMqConfig.getSubscriberPassword());
  7. subsCachingConnectionFactory.setVirtualHost(rabbitMqConfig.getVhost());
  8. subsCachingConnectionFactory.setConnectionNameStrategy(f -> "subscriberConnection");
  9. return subsCachingConnectionFactory;
  10. }
  11.  
  12. @RabbitListener(id="messageListener",queues = "#{rabbitMqConfig.getSubscriberQueueName()}",containerFactory="queueListenerContainer")
  13. public void receiveMessage(Message message, Channel channel, @Header("id") String messageId,
  14. @Header("amqp_deliveryTag") Long deliveryTag) {
  15.  
  16. LOGGER.info(" Message:"+ message.toString());
  17. }
  18.  
  19. Queues are configured like Sample.Q1, Sample.Q2.
  20. But this is not working.
  21.  
  22.  
  23. ----------
  24. Error Log:
  25.  
  26. Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no queue 'sample.q1,Hydra.clone.q2' in vhost 'Sample.services', class-id=50, method-id=10)
  27. at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)
  28. at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36)
  29. at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:494)
  30. at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:288)
  31. at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:138)
  32. ... 14 common frames omitted
  33. Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; protocol method: #method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no queue 'Sample.q1,Sample.q2' in vhost 'Sample.services', class-id=50, method-id=10)
  34. at com.rabbitmq.client.impl.ChannelN.asyncShutdown(ChannelN.java:516)
  35. at com.rabbitmq.client.impl.ChannelN.processAsync(ChannelN.java:346)
  36. at com.rabbitmq.client.impl.AMQChannel.handleCompleteInboundCommand(AMQChannel.java:178)
  37. at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:111)
  38. at com.rabbitmq.client.impl.AMQConnection.readFrame(AMQConnection.java:670)
  39. at com.rabbitmq.client.impl.AMQConnection.access$300(AMQConnection.java:48)
  40. at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:597)
  41. ... 1 common frames omitted
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement