In My Scenario I need to create a lots of queues dynamically at run time that is why I don't want to use @Bean instead want to write a function that create queue and I will call it whenever necessary. Here When i use @bean annotation it creates queue on rabbitmq server.
@Bean
public Queue productQueue(final String queueName) {
return new Queue(queueName);
}
But with the same code without @Bean
public Queue productQueue(final String queueName) {
return new Queue(queueName);
}
when call this function doesn't create queue on rabbitmq server
Queue queue = <Object>.productQueue("product-queue");
whenever necessary? You want to call it from an external service?