Polishing
Resolves #6 Resolves #7 The further polishing: new line after author list
This commit is contained in:
committed by
Artem Bilan
parent
df4a3a621a
commit
e0914c5e98
@@ -240,6 +240,7 @@ import org.springframework.context.annotation.Import;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @author Gary Russell
|
||||
*
|
||||
* @see KafkaListener
|
||||
* @see KafkaListenerAnnotationBeanPostProcessor
|
||||
* @see org.springframework.kafka.listener.KafkaListenerEndpointRegistrar
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.springframework.kafka.listener.KafkaListenerEndpointRegistry;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @author Gary Russell
|
||||
*
|
||||
* @see KafkaListenerAnnotationBeanPostProcessor
|
||||
* @see KafkaListenerEndpointRegistry
|
||||
* @see EnableKafka
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.springframework.messaging.handler.annotation.MessageMapping;
|
||||
* must be able to select exactly one method based on the payload type.</b>
|
||||
*
|
||||
* @author Gary Russell
|
||||
*
|
||||
* @see EnableKafka
|
||||
* @see KafkaListener
|
||||
* @see KafkaListenerAnnotationBeanPostProcessor
|
||||
|
||||
@@ -71,7 +71,9 @@ import org.springframework.messaging.handler.annotation.MessageMapping;
|
||||
* methods must not cause any ambiguity such that a single method can be resolved for a
|
||||
* particular inbound message. The {@link MessagingMessageListenerAdapter} is configured with
|
||||
* a {@link org.springframework.kafka.listener.MultiMethodKafkaListenerEndpoint}.
|
||||
*
|
||||
* @author Gary Russell
|
||||
*
|
||||
* @see EnableKafka
|
||||
* @see KafkaListenerAnnotationBeanPostProcessor
|
||||
* @see KafkaListeners
|
||||
@@ -130,7 +132,6 @@ public @interface KafkaListener {
|
||||
* This allows, for example, iteration over the collection to start/stop a subset
|
||||
* of containers.
|
||||
* @return the bean name for the group.
|
||||
* @since 1.5
|
||||
*/
|
||||
String group() default "";
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Stephane Nicoll
|
||||
* @author Juergen Hoeller
|
||||
* @author Gary Russell
|
||||
* @since 1.4
|
||||
*
|
||||
* @see KafkaListener
|
||||
* @see EnableKafka
|
||||
* @see KafkaListenerConfigurer
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.springframework.kafka.listener.KafkaListenerEndpointRegistrar;
|
||||
* <p>See @{@link EnableKafka} for detailed usage examples.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @since 1.4
|
||||
*
|
||||
* @see EnableKafka
|
||||
* @see org.springframework.kafka.listener.KafkaListenerEndpointRegistrar
|
||||
*/
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.lang.annotation.Target;
|
||||
* (or class), implicitly generating this container annotation.
|
||||
*
|
||||
* @author Gary Russell
|
||||
*
|
||||
* @see KafkaListener
|
||||
*/
|
||||
@Target({ ElementType.TYPE, ElementType.METHOD, ElementType.ANNOTATION_TYPE })
|
||||
|
||||
@@ -15,10 +15,19 @@
|
||||
*/
|
||||
package org.springframework.kafka.annotation;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Used to add topic/partition information to a {@code KafkaListener}.
|
||||
*
|
||||
* @author Gary Russell
|
||||
*
|
||||
*/
|
||||
@Target({})
|
||||
@Retention(RUNTIME)
|
||||
public @interface TopicPartition {
|
||||
|
||||
String topic() default "";
|
||||
|
||||
@@ -18,10 +18,6 @@ package org.springframework.kafka.config;
|
||||
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.kafka.core.ConsumerFactory;
|
||||
import org.springframework.kafka.listener.AbstractMessageListenerContainer;
|
||||
@@ -34,13 +30,12 @@ import org.springframework.kafka.listener.KafkaListenerEndpoint;
|
||||
* Base {@link KafkaListenerContainerFactory} for Spring's base container implementation.
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*
|
||||
* @see AbstractMessageListenerContainer
|
||||
*/
|
||||
public abstract class AbstractKafkaListenerContainerFactory<C extends AbstractMessageListenerContainer<K, V>, K, V>
|
||||
implements KafkaListenerContainerFactory<C> {
|
||||
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private ConsumerFactory<K, V> consumerFactory;
|
||||
|
||||
private ErrorHandler errorHandler;
|
||||
@@ -49,8 +44,6 @@ public abstract class AbstractKafkaListenerContainerFactory<C extends AbstractMe
|
||||
|
||||
private Integer phase;
|
||||
|
||||
protected final AtomicInteger counter = new AtomicInteger();
|
||||
|
||||
private Executor taskExecutor;
|
||||
|
||||
private Integer ackCount;
|
||||
@@ -172,7 +165,7 @@ public abstract class AbstractKafkaListenerContainerFactory<C extends AbstractMe
|
||||
* Further initialize the specified container.
|
||||
* <p>Subclasses can inherit from this method to apply extra
|
||||
* configuration if necessary.
|
||||
* @param instance the containe instance to configure.
|
||||
* @param instance the container instance to configure.
|
||||
*/
|
||||
protected void initializeContainer(C instance) {
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ package org.springframework.kafka.config;
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Gary Russell
|
||||
* @since 1.4
|
||||
*/
|
||||
public abstract class KafkaListenerConfigUtils {
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public class SimpleKafkaListenerContainerFactory<K, V>
|
||||
|
||||
private Integer concurrency;
|
||||
|
||||
private Long receentOffset;
|
||||
private Long recentOffset;
|
||||
|
||||
private ContainerOffsetResetStrategy resetStrategy;
|
||||
|
||||
@@ -54,11 +54,11 @@ public class SimpleKafkaListenerContainerFactory<K, V>
|
||||
}
|
||||
|
||||
/**
|
||||
* @param receentOffset the recent offset.
|
||||
* @param recentOffset the recent offset.
|
||||
* @see ConcurrentMessageListenerContainer#setRecentOffset(long)
|
||||
*/
|
||||
public void setReceentOffset(Long receentOffset) {
|
||||
this.receentOffset = receentOffset;
|
||||
public void setRecentOffset(Long recentOffset) {
|
||||
this.recentOffset = recentOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,8 +95,8 @@ public class SimpleKafkaListenerContainerFactory<K, V>
|
||||
if (this.concurrency != null) {
|
||||
instance.setConcurrency(this.concurrency);
|
||||
}
|
||||
if (this.receentOffset != null) {
|
||||
instance.setRecentOffset(this.receentOffset);
|
||||
if (this.recentOffset != null) {
|
||||
instance.setRecentOffset(this.recentOffset);
|
||||
}
|
||||
if (this.resetStrategy != null) {
|
||||
instance.setResetStrategy(this.resetStrategy);
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @author Gary Russell
|
||||
*
|
||||
* @see MethodKafkaListenerEndpoint
|
||||
* @see org.springframework.kafka.config.SimpleKafkaListenerEndpoint
|
||||
*/
|
||||
@@ -162,7 +163,6 @@ public abstract class AbstractKafkaListenerEndpoint<K, V>
|
||||
/**
|
||||
* Set the group for the corresponding listener container.
|
||||
* @param group the group.
|
||||
* @since 1.5
|
||||
*/
|
||||
public void setGroup(String group) {
|
||||
this.group = group;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2016 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.
|
||||
@@ -24,7 +24,6 @@ import org.apache.kafka.clients.consumer.ConsumerRecord;
|
||||
*
|
||||
* @author Marius Bogoevici
|
||||
* @author Gary Russell
|
||||
* @since 1.0.1
|
||||
*/
|
||||
public interface AcknowledgingMessageListener<K, V> {
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ package org.springframework.kafka.listener;
|
||||
*
|
||||
* @author Marius Bogoevici
|
||||
* @author Gary Russell
|
||||
* @since 1.0.1
|
||||
*/
|
||||
public interface Acknowledgment {
|
||||
|
||||
|
||||
@@ -40,8 +40,6 @@ import org.springframework.util.Assert;
|
||||
*/
|
||||
public class ConcurrentMessageListenerContainer<K, V> extends AbstractMessageListenerContainer<K, V> {
|
||||
|
||||
private static final int DEFAULT_STOP_TIMEOUT = 1000;
|
||||
|
||||
private final ConsumerFactory<K, V> consumerFactory;
|
||||
|
||||
private final String[] topics;
|
||||
@@ -58,8 +56,6 @@ public class ConcurrentMessageListenerContainer<K, V> extends AbstractMessageLis
|
||||
|
||||
int concurrency = 1;
|
||||
|
||||
private int stopTimeout = DEFAULT_STOP_TIMEOUT;
|
||||
|
||||
/**
|
||||
* Construct an instance with the supplied configuration properties and specific
|
||||
* topics/partitions - when using this constructor, a
|
||||
@@ -148,20 +144,6 @@ public class ConcurrentMessageListenerContainer<K, V> extends AbstractMessageLis
|
||||
this.concurrency = concurrency;
|
||||
}
|
||||
|
||||
/**
|
||||
* The timeout for waiting for each concurrent {@link MessageListener} to finish on
|
||||
* stopping.
|
||||
* @param stopTimeout timeout in milliseconds
|
||||
* @since 1.1
|
||||
*/
|
||||
public void setStopTimeout(int stopTimeout) {
|
||||
this.stopTimeout = stopTimeout;
|
||||
}
|
||||
|
||||
public int getStopTimeout() {
|
||||
return stopTimeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the list of {@link KafkaMessageListenerContainer}s created by
|
||||
* this container.
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.apache.kafka.common.TopicPartition;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @author Gary Russell
|
||||
* @since 1.4
|
||||
*/
|
||||
public interface KafkaListenerEndpoint {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
* Copyright 2014-2016 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.
|
||||
@@ -33,7 +33,8 @@ import org.springframework.util.Assert;
|
||||
* @author Stephane Nicoll
|
||||
* @author Juergen Hoeller
|
||||
* @author Artem Bilan
|
||||
* @since 1.4
|
||||
* @author Gary Russell
|
||||
*
|
||||
* @see org.springframework.kafka.annotation.KafkaListenerConfigurer
|
||||
*/
|
||||
public class KafkaListenerEndpointRegistrar implements BeanFactoryAware, InitializingBean {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
* Copyright 2014-2016 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.
|
||||
@@ -56,7 +56,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Juergen Hoeller
|
||||
* @author Artem Bilan
|
||||
* @author Gary Russell
|
||||
* @since 1.4
|
||||
*
|
||||
* @see KafkaListenerEndpoint
|
||||
* @see MessageListenerContainer
|
||||
* @see KafkaListenerContainerFactory
|
||||
@@ -97,7 +97,6 @@ public class KafkaListenerEndpointRegistry implements DisposableBean, SmartLifec
|
||||
* Return the ids of the managed {@link MessageListenerContainer} instance(s).
|
||||
* @return the ids.
|
||||
* @see #getListenerContainer(String)
|
||||
* @since 1.5.2
|
||||
*/
|
||||
public Set<String> getListenerContainerIds() {
|
||||
return Collections.unmodifiableSet(this.listenerContainers.keySet());
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.springframework.context.SmartLifecycle;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @author Gary Russell
|
||||
* @since 1.4
|
||||
*/
|
||||
public interface MessageListenerContainer extends SmartLifecycle {
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @author Artem Bilan
|
||||
* @since 1.4
|
||||
* @author Gary Russell
|
||||
*/
|
||||
public class MethodKafkaListenerEndpoint<K, V> extends AbstractKafkaListenerEndpoint<K, V> {
|
||||
|
||||
|
||||
@@ -32,8 +32,6 @@ public class MultiMethodKafkaListenerEndpoint<K, V> extends MethodKafkaListenerE
|
||||
|
||||
private final List<Method> methods;
|
||||
|
||||
private DelegatingInvocableHandler delegatingHandler;
|
||||
|
||||
public MultiMethodKafkaListenerEndpoint(List<Method> methods, Object bean) {
|
||||
this.methods = methods;
|
||||
setBean(bean);
|
||||
@@ -46,8 +44,9 @@ public class MultiMethodKafkaListenerEndpoint<K, V> extends MethodKafkaListenerE
|
||||
invocableHandlerMethods.add(getMessageHandlerMethodFactory()
|
||||
.createInvocableHandlerMethod(getBean(), method));
|
||||
}
|
||||
this.delegatingHandler = new DelegatingInvocableHandler(invocableHandlerMethods, getBean());
|
||||
return new HandlerAdapter(this.delegatingHandler);
|
||||
DelegatingInvocableHandler delegatingHandler =
|
||||
new DelegatingInvocableHandler(invocableHandlerMethods, getBean());
|
||||
return new HandlerAdapter(delegatingHandler);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.springframework.kafka.listener.MessageListener;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
* @author Gary Russell
|
||||
*
|
||||
* @see MessageListener
|
||||
* @see AcknowledgingMessageListener
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2016 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.
|
||||
@@ -24,7 +24,6 @@ import org.springframework.messaging.handler.invocation.InvocableHandlerMethod;
|
||||
* underlying handler.
|
||||
*
|
||||
* @author Gary Russell
|
||||
* @since 1.5
|
||||
*
|
||||
*/
|
||||
public class HandlerAdapter {
|
||||
|
||||
@@ -39,7 +39,6 @@ import org.springframework.messaging.converter.MessageConversionException;
|
||||
* @author Stephane Nicoll
|
||||
* @author Gary Russell
|
||||
* @author Artem Bilan
|
||||
* @since 1.4
|
||||
*/
|
||||
public class MessagingMessageListenerAdapter<K, V> extends AbstractAdaptableMessageListener<K, V> {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2015 the original author or authors.
|
||||
* Copyright 2014-2016 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.
|
||||
@@ -19,7 +19,6 @@ package org.springframework.kafka.support;
|
||||
/**
|
||||
* @author Artem Bilan
|
||||
* @author Marius Bogoevici
|
||||
* @since 1.0
|
||||
*/
|
||||
public abstract class KafkaHeaders {
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ public class MessagingMessageConverter<K, V> implements MessageConverter<K, V> {
|
||||
* Generate {@code timestamp} for produced messages. If set to {@code false}, -1 is
|
||||
* used instead. By default set to {@code false}.
|
||||
* @param generateTimestamp true if a timestamp should be generated
|
||||
* @since 1.1
|
||||
*/
|
||||
public void setGenerateTimestamp(boolean generateTimestamp) {
|
||||
this.generateTimestamp = generateTimestamp;
|
||||
|
||||
@@ -56,7 +56,6 @@ import org.springframework.kafka.rule.KafkaEmbedded;
|
||||
|
||||
/**
|
||||
* @author Gary Russell
|
||||
* @since 2.0
|
||||
*
|
||||
*/
|
||||
public class ConcurrentMessageListenerContainerTests {
|
||||
|
||||
Reference in New Issue
Block a user