Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ well, where all services code is in Spring.

### Requirements

* Spring 5+, 6+
* Spring 5+, 6+, 7+
* Java 1.8+,17
* Spring boot 2+,3+
* Spring boot 2+,3+,4+
* Lettuce client for Redis cluster
* Read master preference for Redis cluster

Expand Down Expand Up @@ -98,6 +98,7 @@ from [Maven central](https://search.maven.org/search?q=g:com.github.sonus21%20AN

* For spring framework 5.x use rqueue-spring 2.x
* For spring framework 6.x use rqueue-spring 3.x
* For spring framework 7.x use rqueue-spring 4.x

Get the latest one
from [Maven central](https://search.maven.org/search?q=g:com.github.sonus21%20AND%20a:rqueue-spring)
Expand Down
58 changes: 31 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id "jacoco"
id 'com.github.kt3k.coveralls' version '2.12.2'
id "com.adarshr.test-logger" version "3.2.0"
id "org.gradle.test-retry" version "1.5.0"
id "com.adarshr.test-logger" version "4.0.0"
id "org.gradle.test-retry" version "1.6.4"
}

allprojects {
Expand All @@ -12,8 +12,10 @@ allprojects {
apply plugin: "com.adarshr.test-logger"
apply plugin: "org.gradle.test-retry"

sourceCompatibility = 17
targetCompatibility = 17
java {
sourceCompatibility = "17"
targetCompatibility = "17"
}

repositories {
mavenCentral()
Expand All @@ -22,15 +24,15 @@ allprojects {
}

ext {
springBootVersion = "3.0.1"
springVersion = "6.0.3"
springDataVersion = "3.0.0"
microMeterVersion = "1.10.2"
springBootVersion = "4.0.1"
springVersion = "7.0.3"
springDataVersion = "4.0.2"
microMeterVersion = "1.16.2"

// logging dependencies
lombokVersion = "1.18.30"
logbackVersion = "1.4.5"
sl4jVersion = "2.0.6"
lombokVersion = "1.18.42"
logbackVersion = "1.5.25"
sl4jVersion = "2.0.17"

// testing
jupiterVersion = "5.5.0"
Expand All @@ -42,34 +44,35 @@ ext {
tomcatVersion = "10.1.4"

// utility
lang3Version = "3.9"
jacksonVersion = "2.14.1"
lang3Version = "3.20.0"
jacksonVersion = "3.0.3"
jacksonAnnotationsVersion = "2.21"

// server
jakartaServletVersion = "6.0.0"
pebbleVersion = "3.2.2"
jakartaServletVersion = "6.1.0"
pebbleVersion = "4.1.0"

// database
lettuceVersion = "6.2.2.RELEASE"
jakartaAnnotationVersion = "2.1.0"
jakartaPersistenceVersion = "3.1.0"
hibernateCoreVersion = "5.6.14.Final"
lettuceVersion = "7.2.1.RELEASE"
jakartaAnnotationVersion = "3.0.0"
jakartaPersistenceVersion = "3.2.0"
hibernateCoreVersion = "7.2.1.Final"

// other dependencies
jakartaValidationApiVersion = "3.0.2"
jakartaValidationApiVersion = "3.1.1"
serucoEncodingVersion = "0.1.3"
apacheCommonCollectionVerion = "4.4"
hibernateValidatorVersion = "7.0.5.Final"
springDepManagementVersion = "1.1.0"
projectReactorReactorTestVersion = "3.5.1"
aspectjVersion = "1.9.19"
guavaVersion = "32.1.1-jre"
apacheCommonCollectionVerion = "4.5.0"
hibernateValidatorVersion = "9.1.0.Final"
springDepManagementVersion = "1.1.7"
projectReactorReactorTestVersion = "3.8.2"
aspectjVersion = "1.9.25.1"
guavaVersion = "33.5.0-jre"
}


subprojects {
group = "com.github.sonus21"
version = "3.4.0-RELEASE"
version = "4.0.0-RELEASE"

dependencies {
// https://mvnrepository.com/artifact/org.springframework/spring-messaging
Expand All @@ -94,6 +97,7 @@ subprojects {
// https://mvnrepository.com/artifact/ch.qos.logback/logback-classic
testImplementation "ch.qos.logback:logback-classic:${logbackVersion}"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${jupiterVersion}"
testRuntimeOnly "org.junit.platform:junit-platform-launcher:6.0.2"
testImplementation "org.junit.jupiter:junit-jupiter-api:${jupiterVersion}"
testImplementation "org.junit.jupiter:junit-jupiter-params:${jupiterVersion}"
// https://mvnrepository.com/artifact/org.mockito/mockito-inline
Expand Down
11 changes: 6 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ frameworks.

### Requirements

* Spring 5+, 6+
* Spring Boot 2+, 3+
* Spring 5+, 6+, 7+
* Spring Boot 2+, 3+, 4+
* Spring Reactive
* Lettuce client for Redis cluster
* Read master preference for Redis cluster
Expand Down Expand Up @@ -82,8 +82,8 @@ Redis cluster compatibility, otherwise the application may fail to start.
### Spring Boot

{: .warning }
Use Rqueue Spring Boot Starter 3.x for Spring Boot 3.x, and Rqueue Spring Boot Starter 2.x for
Spring Boot 2.x.
Use Rqueue Spring Boot Starter 4.x for Spring Boot 4.x, Rqueue Spring Boot Starter 3.x for
Spring Boot 3.x, and Rqueue Spring Boot Starter 2.x for Spring Boot 2.x.

Get the latest version of Rqueue Spring Boot Starter from [Maven Central][Boot Maven Central]. Add
the dependency to your project:
Expand Down Expand Up @@ -125,7 +125,8 @@ the dependency to your project:
### Spring Framework

{: .warning }
Use Rqueue Spring 3.x for Spring Framework 6.x, and Rqueue Spring 2.x for Spring Framework 5.x.
Use Rqueue Spring 4.x for Spring Framework 7.x, Rqueue Spring 3.x for Spring Framework 6.x,
and Rqueue Spring 2.x for Spring Framework 5.x.

Get the latest version of Rqueue Spring from [Maven Central][Maven Central]. Add the dependency to
your project:
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
29 changes: 17 additions & 12 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions rqueue-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ mavenPublishing {

dependencies {
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
api "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
api "com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}"
api "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
api "tools.jackson.core:jackson-core:${jacksonVersion}"
api "tools.jackson.core:jackson-databind:${jacksonVersion}"
api "com.fasterxml.jackson.core:jackson-annotations:${jacksonAnnotationsVersion}"
// https://mvnrepository.com/artifact/jakarta.servlet/jakarta.servlet-api
api "jakarta.servlet:jakarta.servlet-api:${jakartaServletVersion}"
// https://mvnrepository.com/artifact/jakarta.validation/jakarta.validation-api
api "jakarta.validation:jakarta.validation-api:${jakartaValidationApiVersion}"
implementation 'jakarta.el:jakarta.el-api:5.0.0'
runtimeOnly 'org.glassfish:jakarta.el:4.0.2'
// https://mvnrepository.com/artifact/org.springframework/spring-webmvc
api "org.springframework:spring-webmvc:${springVersion}"
api "org.springframework:spring-webflux:${springVersion}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@

import static org.springframework.util.Assert.notNull;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.sonus21.rqueue.utils.SerializationUtils;
import java.lang.reflect.TypeVariable;
import java.util.Collection;
Expand All @@ -34,6 +31,9 @@
import org.springframework.messaging.MessageHeaders;
import org.springframework.messaging.converter.SmartMessageConverter;
import org.springframework.messaging.support.GenericMessage;
import tools.jackson.core.JacksonException;
import tools.jackson.databind.JavaType;
import tools.jackson.databind.ObjectMapper;

/**
* A converter to turn the payload of a {@link Message} from serialized form to a typed String and
Expand Down Expand Up @@ -212,7 +212,7 @@ public String serialize(Object payload) {
String msg = objectMapper.writeValueAsString(payload);
Msg message = new Msg(msg, name);
return objectMapper.writeValueAsString(message);
} catch (JsonProcessingException e) {
} catch (JacksonException e) {
log.debug("Serialisation failed", e);
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@

import static org.springframework.util.Assert.notNull;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.sonus21.rqueue.utils.SerializationUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;
import org.springframework.messaging.converter.MappingJackson2MessageConverter;
import org.springframework.messaging.converter.JacksonJsonMessageConverter;
import org.springframework.messaging.converter.MessageConverter;
import org.springframework.messaging.support.GenericMessage;
import tools.jackson.core.JacksonException;
import tools.jackson.databind.ObjectMapper;

/**
* JsonMessageConverter tries to convert to JSON and from JSON to object.
Expand All @@ -37,7 +37,7 @@
* <p>Target class is null till the time method arguments are not resolved, once method arguments
* are resolved then it will become non-null.
*
* @see MappingJackson2MessageConverter
* @see JacksonJsonMessageConverter
*/
@Slf4j
public class JsonMessageConverter implements MessageConverter {
Expand Down Expand Up @@ -65,7 +65,7 @@ public Object fromMessage(Message<?> message, Class<?> targetClass) {
return objectMapper.readValue(payload, targetClass);
}
return null;
} catch (JsonProcessingException | ClassCastException e) {
} catch (JacksonException | ClassCastException e) {
log.debug("Deserialization of message {} failed", message, e);
return null;
}
Expand All @@ -77,7 +77,7 @@ public Message<?> toMessage(Object payload, MessageHeaders headers) {
try {
String msg = objectMapper.writeValueAsString(payload);
return new GenericMessage<>(msg);
} catch (JsonProcessingException e) {
} catch (JacksonException e) {
log.debug("Serialisation failed, Payload: {}", payload, e);
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
package com.github.sonus21.rqueue.converter;

import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import com.github.sonus21.rqueue.utils.SerializationUtils;
import java.io.IOException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.support.NullValue;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.data.redis.serializer.SerializationException;
import tools.jackson.core.JacksonException;
import tools.jackson.core.JsonGenerator;
import tools.jackson.databind.DefaultTyping;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.SerializationContext;
import tools.jackson.databind.jsontype.BasicPolymorphicTypeValidator;
import tools.jackson.databind.module.SimpleModule;
import tools.jackson.databind.ser.std.StdSerializer;

@Slf4j
public class RqueueRedisSerializer implements RedisSerializer<Object> {
Expand Down Expand Up @@ -68,10 +68,12 @@ private static class RqueueRedisSerDes implements RedisSerializer<Object> {
private ObjectMapper mapper;

RqueueRedisSerDes() {
this.mapper = SerializationUtils.createObjectMapper();
this.mapper =
mapper.registerModule(new SimpleModule().addSerializer(new NullValueSerializer()));
this.mapper = mapper.enableDefaultTyping(DefaultTyping.NON_FINAL, As.PROPERTY);
this.mapper = SerializationUtils.createObjectMapper().rebuild()
.addModule(new SimpleModule().addSerializer(new NullValueSerializer()))
.activateDefaultTyping(BasicPolymorphicTypeValidator.builder()
.allowIfSubType(Object.class)
.build(), DefaultTyping.NON_FINAL, As.PROPERTY)
.build();
}

@Override
Expand All @@ -81,7 +83,7 @@ public byte[] serialize(Object source) throws SerializationException {
}
try {
return mapper.writeValueAsBytes(source);
} catch (JsonProcessingException e) {
} catch (JacksonException e) {
throw new SerializationException("Could not write JSON: " + e.getMessage(), e);
}
}
Expand Down Expand Up @@ -109,11 +111,9 @@ private static class NullValueSerializer extends StdSerializer<NullValue> {
}

@Override
public void serialize(
NullValue value, JsonGenerator jsonGenerator, SerializerProvider provider)
throws IOException {
public void serialize(NullValue value, JsonGenerator jsonGenerator, SerializationContext provider) throws JacksonException {
jsonGenerator.writeStartObject();
jsonGenerator.writeStringField(classIdentifier, NullValue.class.getName());
jsonGenerator.writeStringProperty(classIdentifier, NullValue.class.getName());
jsonGenerator.writeEndObject();
}
}
Expand Down
Loading