AMQP-131: copy config from old base class
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package org.springframework.amqp.helloworld;
|
||||
|
||||
import org.springframework.amqp.core.Queue;
|
||||
import org.springframework.amqp.rabbit.config.AbstractRabbitConfiguration;
|
||||
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
|
||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
@@ -9,7 +8,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class HelloWorldConfiguration extends AbstractRabbitConfiguration {
|
||||
public class HelloWorldConfiguration {
|
||||
|
||||
protected final String helloWorldQueueName = "hello.world.queue";
|
||||
|
||||
@@ -21,7 +20,6 @@ public class HelloWorldConfiguration extends AbstractRabbitConfiguration {
|
||||
return connectionFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RabbitTemplate rabbitTemplate() {
|
||||
RabbitTemplate template = new RabbitTemplate(connectionFactory());
|
||||
//The routing key is set to the name of the queue by the broker for the default exchange.
|
||||
|
||||
@@ -2,7 +2,6 @@ package org.springframework.amqp.helloworld.async;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.springframework.amqp.rabbit.config.AbstractRabbitConfiguration;
|
||||
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
|
||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
@@ -14,11 +13,10 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor;
|
||||
|
||||
@Configuration
|
||||
public class ProducerConfiguration extends AbstractRabbitConfiguration {
|
||||
public class ProducerConfiguration {
|
||||
|
||||
protected final String helloWorldQueueName = "hello.world.queue";
|
||||
|
||||
@Override
|
||||
public RabbitTemplate rabbitTemplate() {
|
||||
RabbitTemplate template = new RabbitTemplate(connectionFactory());
|
||||
template.setRoutingKey(this.helloWorldQueueName);
|
||||
|
||||
@@ -16,10 +16,11 @@
|
||||
|
||||
package org.springframework.amqp.rabbit.stocks.config;
|
||||
|
||||
import org.springframework.amqp.core.AmqpAdmin;
|
||||
import org.springframework.amqp.core.TopicExchange;
|
||||
import org.springframework.amqp.rabbit.config.AbstractRabbitConfiguration;
|
||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
|
||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||
import org.springframework.amqp.rabbit.core.RabbitAdmin;
|
||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||
import org.springframework.amqp.support.converter.JsonMessageConverter;
|
||||
import org.springframework.amqp.support.converter.MessageConverter;
|
||||
@@ -36,7 +37,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
* @author Mark Fisher
|
||||
*/
|
||||
@Configuration
|
||||
public abstract class AbstractStockAppRabbitConfiguration extends AbstractRabbitConfiguration {
|
||||
public abstract class AbstractStockAppRabbitConfiguration {
|
||||
|
||||
/**
|
||||
* Shared topic exchange used for publishing any market data (e.g. stock quotes)
|
||||
@@ -87,4 +88,13 @@ public abstract class AbstractStockAppRabbitConfiguration extends AbstractRabbit
|
||||
return new TopicExchange(MARKET_DATA_EXCHANGE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the admin bean that can declare queues etc.
|
||||
*/
|
||||
@Bean
|
||||
public AmqpAdmin amqpAdmin() {
|
||||
RabbitAdmin rabbitAdmin = new RabbitAdmin(connectionFactory());
|
||||
return rabbitAdmin ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -47,13 +47,6 @@ public class RabbitClientConfiguration extends AbstractStockAppRabbitConfigurati
|
||||
@Autowired
|
||||
private ClientHandler clientHandler;
|
||||
|
||||
|
||||
// Create the Queue definitions that write up the Message listener container
|
||||
|
||||
//private Queue marketDataQueue = new UniquelyNamedQueue("mktdata");
|
||||
|
||||
//private Queue traderJoeQueue = new UniquelyNamedQueue("joe");
|
||||
|
||||
/**
|
||||
* The client's template will by default send to the exchange defined
|
||||
* in {@link org.springframework.amqp.rabbit.config.AbstractRabbitConfiguration#rabbitTemplate()}
|
||||
|
||||
Reference in New Issue
Block a user