SHARE
TWEET

Untitled

a guest Jun 13th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Configuration
  2. public class serverConfiguration {
  3.    private String queueName;
  4.    ...
  5.    @Bean
  6.    public Queue buildQueue() {
  7.     Queue queue = new Queue(this.queueName, false, false, true, getQueueArguments());
  8.     buildRabbitAdmin().declareQueue(queue);
  9.     return queue;
  10.    }
  11.    ...
  12. }
  13.      
  14. @Configuration
  15. public class serverConfiguration {
  16.    private String queueName;
  17.    ...
  18.    @Bean
  19.    @Scope("prototype")
  20.    public Queue buildQueue() {
  21.     Queue queue = new Queue(this.queueName, false, false, true, getQueueArguments());
  22.     buildRabbitAdmin().declareQueue(queue);
  23.     return queue;
  24.    }
  25.    ...
  26. }
  27.      
  28. Map<String, Queue> queueBeans = ((ListableBeanFactory) applicationContext).getBeansOfType(Queue.class);
  29.      
  30. name of the method := the last created instance.
  31.      
  32. context.getBeanFactory().registerSingleton("foo", new Queue("foo"));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top