Skip to content

Commit

Permalink
Reactive test
Browse files Browse the repository at this point in the history
  • Loading branch information
sonus21 committed Apr 11, 2021
1 parent d1d8234 commit d480b0e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ public abstract class ApplicationBasicConfiguration extends RedisBootstrapperBas
@Value("${monitor.enabled:false}")
protected boolean monitoringEnabled;

@Value("${rqueue.reactive.enabled:false}")
protected boolean reactiveEnabled;

protected void init() {
final BootstrapRedis bootstrapRedis =
Javanna.createAnnotation(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.messaging.MessageHeaders;
import org.springframework.messaging.converter.MappingJackson2MessageConverter;
Expand All @@ -45,10 +44,14 @@ public LettuceConnectionFactory redisConnectionFactory() {

@Bean
public SimpleRqueueListenerContainerFactory simpleRqueueListenerContainerFactory(
RedisConnectionFactory redisConnectionFactory) {
LettuceConnectionFactory redisConnectionFactory) {
SimpleRqueueListenerContainerFactory simpleRqueueListenerContainerFactory =
new SimpleRqueueListenerContainerFactory();
simpleRqueueListenerContainerFactory.setRedisConnectionFactory(redisConnectionFactory);
if (reactiveEnabled) {
simpleRqueueListenerContainerFactory.setReactiveRedisConnectionFactory(
redisConnectionFactory);
}
simpleRqueueListenerContainerFactory.setMessageConverters(
Collections.singletonList(new MappingJackson2MessageConverter()));
MessageHeaders messageHeaders =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ public SimpleRqueueListenerContainerFactory simpleRqueueListenerContainerFactory
LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory(redisConfiguration);
connectionFactory.afterPropertiesSet();
simpleRqueueListenerContainerFactory.setRedisConnectionFactory(connectionFactory);
if(reactiveEnabled){
simpleRqueueListenerContainerFactory.setReactiveRedisConnectionFactory(connectionFactory);
}
return simpleRqueueListenerContainerFactory;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,13 @@
import com.github.sonus21.rqueue.utils.Constants;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.connection.RedisClusterConfiguration;
import org.springframework.data.redis.connection.RedisNode;
import org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration;
import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;

public abstract class RedisClusterBaseApplication extends ApplicationBasicConfiguration {
@Value("${rqueue.reactive.enabled:false}")
private boolean reactiveEnabled;

@Bean
public SimpleRqueueListenerContainerFactory simpleRqueueListenerContainerFactory(
Expand All @@ -56,11 +53,8 @@ public SimpleRqueueListenerContainerFactory simpleRqueueListenerContainerFactory
simpleRqueueListenerContainerFactory.setPollingInterval(Constants.ONE_MILLI);
simpleRqueueListenerContainerFactory.setRqueueMessageHandler(rqueueMessageHandler);
if (reactiveEnabled) {
LettuceConnectionFactory reactiveRedisConnectionFactory =
new LettuceConnectionFactory(redisClusterConfiguration);
lettuceConnectionFactory.afterPropertiesSet();
simpleRqueueListenerContainerFactory.setReactiveRedisConnectionFactory(
reactiveRedisConnectionFactory);
lettuceConnectionFactory);
}
return simpleRqueueListenerContainerFactory;
}
Expand Down

0 comments on commit d480b0e

Please sign in to comment.