AMQP-131: remove config base classes - they really were adding no value (copied to samples)

This commit is contained in:
Dave Syer
2011-03-28 13:50:15 +01:00
parent a8d01f7c9d
commit 2220f0c017
2 changed files with 0 additions and 105 deletions

View File

@@ -1,50 +0,0 @@
/*
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.amqp.config;
import org.springframework.amqp.core.AmqpAdmin;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Abstract base class for code based configuration of Spring managed AMQP infrastructure,
* i.e. Exchanges, Queues, and Bindings.
* <p>Subclasses are required to provide an implementation of AmqpAdmin.
* <p>The BindingBuilder class can be used to provide a fluent API to declare bindings.
*
* @author Mark Pollack
* @author Mark Fisher
* @see org.springframework.amqp.core.Exchange
* @see org.springframework.amqp.core.Queue
* @see org.springframework.amqp.core.Binding
* @see org.springframework.amqp.core.BindingBuilder
*/
@Configuration
public abstract class AbstractAmqpConfiguration {
@Bean
public abstract AmqpAdmin amqpAdmin();
/**
* Provides convenient access to the default exchange which is always declared on the broker.
*/
public DirectExchange defaultExchange() {
return new DirectExchange("");
}
}

View File

@@ -1,55 +0,0 @@
/*
* Copyright 2002-2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.amqp.rabbit.config;
import org.springframework.amqp.config.AbstractAmqpConfiguration;
import org.springframework.amqp.core.AmqpAdmin;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Abstract base class for code based configuration of Spring managed Rabbit based broker infrastructure,
* i.e. Queues, Exchanges, Bindings.
* <p>Subclasses are required to provide an implementation of rabbitTemplate from which the the bean
* 'amqpAdmin' will be created.
*
* @author Mark Pollack
* @author Mark Fisher
*/
@Configuration
public abstract class AbstractRabbitConfiguration extends AbstractAmqpConfiguration {
/**
* Create a bean definition for RabbitTemplate. Since there are several properties
* one may want to set after creating a RabbitTemplate from a ConnectionFactory, this
* abstract method is provided to allow for that flexibility as compared to
* automatically creating a RabbitTemplate by specifying a ConnectionFactory.
*/
@Bean
public abstract RabbitTemplate rabbitTemplate();
@Bean
public AmqpAdmin amqpAdmin() {
RabbitAdmin rabbitAdmin = new RabbitAdmin(rabbitTemplate().getConnectionFactory());
rabbitAdmin.setAutoStartup(true);
rabbitAdmin.afterPropertiesSet();
return rabbitAdmin;
}
}