Skip to content

Commit

Permalink
Multiple Fixes (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
sonus21 authored Jul 15, 2022
1 parent 6a775f3 commit b9b7822
Show file tree
Hide file tree
Showing 234 changed files with 615 additions and 413 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ aliases:
executors:
rqueue-executor:
machine:
image: ubuntu-1604:202007-01
image: ubuntu-2004:202201-02

working_directory: ~/repo

Expand All @@ -139,7 +139,7 @@ build_steps: &build_steps
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: gradle dependencies
- run: ./gradlew dependencies
- save_cache:
paths:
- ~/.gradle
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# [Rqueue] New and Notable Changes

### [2.10.2] - 15-Jul-2022

### Fixes

* Message status is not enqueued only, but it should be successful, failed etc
* Weighted queue with size 1 was not working
* Deleted message reappears

### Features

* Disable Rqueue using `rqueue.enabled` flag

### [2.10.1] - 18-Oct-2021

* Fixes for concurrency when task executor is provided see issue #[122]
Expand Down Expand Up @@ -281,4 +293,6 @@ Fixes:

[2.10.1]: https://repo1.maven.org/maven2/com/github/sonus21/rqueue-core/2.10.1-RELEASE

[2.10.2]: https://repo1.maven.org/maven2/com/github/sonus21/rqueue-core/2.10.2-RELEASE

[122]: https://github.com/sonus21/rqueue/issues/122
34 changes: 27 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ well, where all services code is in Spring.

## Features

* **Instant delivery** : Instant execute this message
* **Instant delivery** : Instant execute this message in the background
* **Message scheduling** : A message can be scheduled for any arbitrary period
* **Unique message** : Unique message processing for a queue based on the message id
* **Periodic message** : Process same message at certain interval
Expand Down Expand Up @@ -71,14 +71,14 @@ Release Version: [Maven central](https://search.maven.org/search?q=g:com.github.
* Add dependency
* Gradle
```groovy
implementation 'com.github.sonus21:rqueue-spring-boot-starter:2.10.1-RELEASE'
implementation 'com.github.sonus21:rqueue-spring-boot-starter:2.10.2-RELEASE'
```
* Maven
```xml
<dependency>
<groupId>com.github.sonus21</groupId>
<artifactId>rqueue-spring-boot-starter</artifactId>
<version>2.10.1-RELEASE</version>
<version>2.10.2-RELEASE</version>
</dependency>
```
Expand All @@ -91,14 +91,14 @@ Release Version: [Maven central](https://search.maven.org/search?q=g:com.github.
* Add Dependency
* Gradle
```groovy
implementation 'com.github.sonus21:rqueue-spring:2.10.1-RELEASE'
implementation 'com.github.sonus21:rqueue-spring:2.10.2-RELEASE'
```
* Maven
```xml
<dependency>
<groupId>com.github.sonus21</groupId>
<artifactId>rqueue-spring</artifactId>
<version>2.10.1-RELEASE</version>
<version>2.10.2-RELEASE</version>
</dependency>
```
Expand Down Expand Up @@ -255,12 +255,32 @@ a
PR/[issue](https://github.com/sonus21/rqueue/issues/new?template=i-m-using-rqueue.md&title=Add+my+organisation+in+Rqueue+Users)
.**

<a href="https://tuneyou.com/"><img alt="TuneYou" src="https://raw.githubusercontent.com/sonus21/rqueue/master/docs/static/users/tuneyou.png" width="150" align="middle"/></a>
<a href="https://tuneyou.com"><img alt="TuneYou" src="https://raw.githubusercontent.com/sonus21/rqueue/master/docs/static/users/tuneyou.png" width="150" align="middle"/></a>
&nbsp;&nbsp;
<a href="https://www.pokerstarssports.eu"><img alt="PokerStars" src="https://raw.githubusercontent.com/sonus21/rqueue/master/docs/static/users/pokerstars.png" width="250" align="middle"/></a>
&nbsp;&nbsp;
<a href="https://bitbot.plus/"><img src="https://raw.githubusercontent.com/sonus21/rqueue/master/docs/static/users/bitbot.png" alt="Bitbot" height="60" align="middle"/></a>
<a href="https://bitbot.plus"><img src="https://raw.githubusercontent.com/sonus21/rqueue/master/docs/static/users/bitbot.png" alt="Bitbot" height="60" align="middle"/></a>
&nbsp;&nbsp;
<a href="https://www.chaotiinfo.cn"><img src="https://raw.githubusercontent.com/sonus21/rqueue/master/docs/static/users/chaoti-info.png" alt="CHAOTI INFO TECH(SHENZHEN)" height="60" align="middle"/></a>
&nbsp;&nbsp;

<!---- Signing Key
~/.gradle/gradle.properties file
sonatypeUsername=xyz
sonatypePassword=xyz
signing.keyId=371EDCC6
signing.password=xyz
signing.secretKeyRingFile=/Users/sonu/.gnupg/secring.gpg
For signing generate gpg key using gpg tool using `gpg --gen-key`
signing.password is gpg key password
signing.keyId is last 8 character of gpg key, find using `gpg -K`
signing.secretKeyRingFile=/Users/sonu/.gnupg/secring.gpg generate this as `gpg --keyring secring.gpg --export-secret-keys > ~/.gnupg/secring.gpg`
--->

## Support

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ ext {

subprojects {
group = 'com.github.sonus21'
version = '2.10.1-RELEASE'
version = '2.10.2-RELEASE'

dependencies {
// https://mvnrepository.com/artifact/org.springframework/spring-messaging
Expand Down
Binary file added docs/static/users/chaoti-info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion gradle/code-signing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ artifacts {
archives javadocJar
}

ext.isNotCi = !"true".equals(System.getenv("CI"))
ext.isNotCi = "true" != System.getenv("CI")
signing {
required { isNotCi && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.lang.annotation.Target;
import org.springframework.core.annotation.AliasFor;
import org.springframework.stereotype.Component;

/**
* Indicates that an annotated class is a message listener
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RqueueListener {

/**
* List of unique queues. Queues can be defined by their name, placeholder that would be resolved
* to properties file or could be list of comma separated queue names.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.time.Duration;

public interface RqueueLockManager {

boolean acquireLock(String lockKey, String lockValue, Duration duration);

boolean releaseLock(String lockKey, String lockValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

@Slf4j
public class RqueueRedisTemplate<V extends Serializable> {

protected RedisTemplate<String, V> redisTemplate;

public RqueueRedisTemplate(RedisConnectionFactory redisConnectionFactory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.springframework.util.Assert;

public class RqueueLockManagerImpl implements RqueueLockManager {

private final RqueueStringDao rqueueStringDao;

public RqueueLockManagerImpl(RqueueStringDao rqueueStringDao) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
import com.github.sonus21.rqueue.dao.impl.RqueueStringDaoImpl;
import com.github.sonus21.rqueue.listener.RqueueMessageListenerContainer;
import com.github.sonus21.rqueue.metrics.RqueueQueueMetrics;
import com.github.sonus21.rqueue.utils.ReactiveEnabled;
import com.github.sonus21.rqueue.utils.RedisUtils;
import com.github.sonus21.rqueue.utils.condition.ReactiveEnabled;
import com.github.sonus21.rqueue.utils.pebble.ResourceLoader;
import com.github.sonus21.rqueue.utils.pebble.RqueuePebbleExtension;
import com.mitchellbosecke.pebble.PebbleEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
@Getter
@Setter
public class RqueueWebConfig {

/**
* Control whether web app is enabled or not. If it's marked false then it will throw HTTP 503
* (Service unavailable) error.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ public void setMaxNumWorkers(int maxNumWorkers) {
/**
* Message converter must be configured before calling this method.
*
* @throws IllegalAccessException when messageConverterProvider is null
* @return the message converter object
* @throws IllegalAccessException when messageConverterProvider is null
*/
public MessageConverter getMessageConverter() throws IllegalAccessException {
if (messageConverterProvider == null) {
Expand All @@ -249,15 +249,17 @@ public MessageConverter getMessageConverter() throws IllegalAccessException {
/**
* Rqueue configures a default message converter that can convert message to/from for any object.
*
* @see DefaultMessageConverterProvider
* @param messageConverterProvider the message converter provider
* @see DefaultMessageConverterProvider
*/
public void setMessageConverterProvider(MessageConverterProvider messageConverterProvider) {
notNull(messageConverterProvider, "messageConverterProvider must not be null");
this.messageConverterProvider = messageConverterProvider;
}

/** @return get Redis connection factor */
/**
* @return get Redis connection factor
*/
public RedisConnectionFactory getRedisConnectionFactory() {
return redisConnectionFactory;
}
Expand All @@ -273,7 +275,9 @@ public void setRedisConnectionFactory(RedisConnectionFactory redisConnectionFact
this.redisConnectionFactory = redisConnectionFactory;
}

/** @return message template */
/**
* @return message template
*/
public RqueueMessageTemplate getRqueueMessageTemplate() {
return rqueueMessageTemplate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
*/
@Slf4j
public class GenericMessageConverter implements SmartMessageConverter {

private final SmartMessageSerDes smartMessageSerDes;

public GenericMessageConverter() {
Expand Down Expand Up @@ -85,6 +86,7 @@ public Message<?> toMessage(Object payload, MessageHeaders headers, Object conve
log.trace("Payload: {} headers: {} hint: {}", payload, headers, conversionHint);
return toMessage(payload, headers);
}

/**
* Convert the payload of a {@link Message} from a serialized form to a typed Object of type
* stored in message it self.
Expand Down Expand Up @@ -113,11 +115,13 @@ public Object fromMessage(Message<?> message, Class<?> targetClass) {
@NoArgsConstructor
@AllArgsConstructor
private static class Msg {

private String msg;
private String name;
}

public static class SmartMessageSerDes {

private final ObjectMapper objectMapper;

public SmartMessageSerDes(ObjectMapper objectMapper) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
*/
@Slf4j
public class JsonMessageConverter implements MessageConverter {

private final ObjectMapper objectMapper;

public JsonMessageConverter() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

@Slf4j
public class RqueueRedisSerializer implements RedisSerializer<Object> {

private final RedisSerializer<Object> serializer;

public RqueueRedisSerializer(RedisSerializer<Object> redisSerializer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
* com.github.sonus21.rqueue.annotation.RqueueListener}.
*/
public final class EndpointRegistry {

private static final Object lock = new Object();
private static final Map<String, QueueDetail> queueNameToDetail = new HashMap<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ public interface Job {
/**
* The current status of this job, the message can have different status.
*
* @see MessageMetadata
* @return job status
* @see MessageMetadata
*/
JobStatus getStatus();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@

public abstract class MessageScheduler
implements DisposableBean, ApplicationListener<RqueueBootstrapEvent> {

private final Object monitor = new Object();
@Autowired protected RqueueSchedulerConfig rqueueSchedulerConfig;
@Autowired protected RqueueConfig rqueueConfig;
Expand Down Expand Up @@ -255,6 +256,7 @@ protected long getMinDelay() {
}

private class QueueScheduler {

private void updateLastScheduleTime(String queueName, long time) {
queueNameToLastMessageScheduleTime.put(queueName, time);
}
Expand Down Expand Up @@ -354,6 +356,7 @@ private void checkExistingTask(
@ToString
@AllArgsConstructor
private class MessageMoverTask implements Runnable {

private final String name;
private final String queueName;
private final String zsetName;
Expand Down Expand Up @@ -388,6 +391,7 @@ public String getName() {
}

private class MessageSchedulerListener implements MessageListener {

private void handleMessage(String queueName, Long startTime) {
long lastSeenTime = getLastScheduleTime(queueName);
long currentTime = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

@Slf4j
public class ProcessingQueueMessageScheduler extends MessageScheduler {

private Map<String, Long> queueNameToDelay;

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import reactor.core.publisher.Mono;

public interface ReactiveRqueueMessageEnqueuer {

/**
* Enqueue a message on given queue, consume as soon as possible.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
@SuppressWarnings("unchecked")
@ToString
public class RedisScriptFactory {

public static <T> RedisScript<T> getScript(ScriptType type) {
Resource resource = new ClassPathResource(type.getPath());
DefaultRedisScript<T> script = new DefaultRedisScript<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
@Getter
@Setter
public class RqueueBeanProvider {

@Autowired private RqueueMessageMetadataService rqueueMessageMetadataService;
@Autowired private RqueueSystemConfigDao rqueueSystemConfigDao;
@Autowired private RqueueJobDao rqueueJobDao;
Expand Down
Loading

0 comments on commit b9b7822

Please sign in to comment.