The page you requested could not be found. Try using the navigation {% if site.search_enabled != false %}or search {% endif %}to find what you're looking for or go to this site's home page.
Registering more than one primary handler is not allowed.
30 | */
31 | @Target({ElementType.METHOD})
32 | @Retention(RetentionPolicy.RUNTIME)
33 | @Documented
34 | public @interface RqueueHandler {
35 |
36 | /**
37 | * When true, designate that this is the default method only one method can be so designated.
38 | *
39 | * @return true if this is the default method.
40 | */
41 | boolean primary() default false;
42 | }
43 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/common/ReactiveRqueueRedisTemplate.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.common;
18 |
19 | import com.github.sonus21.rqueue.utils.RedisUtils;
20 | import java.io.Serializable;
21 | import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory;
22 | import org.springframework.data.redis.core.ReactiveRedisTemplate;
23 |
24 | public class ReactiveRqueueRedisTemplate {
25 |
26 | protected ReactiveRedisTemplate redisTemplate;
27 |
28 | public ReactiveRqueueRedisTemplate(ReactiveRedisConnectionFactory redisConnectionFactory) {
29 | this.redisTemplate = RedisUtils.getReactiveRedisTemplate(redisConnectionFactory);
30 | }
31 |
32 | public ReactiveRedisTemplate template() {
33 | return redisTemplate;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/common/RqueueLockManager.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.common;
18 |
19 | import java.time.Duration;
20 |
21 | public interface RqueueLockManager {
22 |
23 | boolean acquireLock(String lockKey, String lockValue, Duration duration);
24 |
25 | boolean releaseLock(String lockKey, String lockValue);
26 | }
27 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/converter/DefaultMessageConverterProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.converter;
18 |
19 | import com.github.sonus21.rqueue.core.DefaultRqueueMessageConverter;
20 | import org.springframework.messaging.converter.MessageConverter;
21 |
22 | public class DefaultMessageConverterProvider implements MessageConverterProvider {
23 |
24 | @Override
25 | public MessageConverter getConverter() {
26 | return new DefaultRqueueMessageConverter();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/core/context/Context.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.core.context;
18 |
19 | import com.github.sonus21.rqueue.core.middleware.ContextMiddleware;
20 |
21 | /**
22 | * A context that supports getValue method. Context is used inside job and middleware
23 | *
24 | * @see DefaultContext
25 | * @see ContextMiddleware
26 | */
27 | public interface Context {
28 |
29 | /**
30 | * Return value form the context.
31 | *
32 | * @param key context key to be searched.
33 | * @return value or null
34 | */
35 | Object getValue(Object key);
36 | }
37 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/core/middleware/LoggingMiddleware.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.core.middleware;
18 |
19 | import com.github.sonus21.rqueue.core.Job;
20 | import java.util.concurrent.Callable;
21 | import lombok.extern.slf4j.Slf4j;
22 |
23 | /**
24 | * A simple logging middleware that logs queue and job id for visibility
25 | */
26 | @Slf4j
27 | public class LoggingMiddleware implements Middleware {
28 |
29 | @Override
30 | public void handle(Job job, Callable next) throws Exception {
31 | log.info("Queue: {}, JobId: {}", job.getRqueueMessage().getQueueName(), job.getId());
32 | next.call();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/core/middleware/RateLimiterMiddleware.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.core.middleware;
18 |
19 | import com.github.sonus21.rqueue.core.Job;
20 | import com.github.sonus21.rqueue.models.enums.JobStatus;
21 | import java.util.concurrent.Callable;
22 |
23 | public interface RateLimiterMiddleware extends TimeProviderMiddleware {
24 |
25 | boolean isThrottled(Job job);
26 |
27 | @Override
28 | default void handle(Job job, Callable callable) throws Exception {
29 | if (isThrottled(job)) {
30 | job.release(JobStatus.FAILED, "Throttled", releaseIn(job));
31 | } else {
32 | callable.call();
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/dao/RqueueJobDao.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.dao;
18 |
19 | import com.github.sonus21.rqueue.models.db.RqueueJob;
20 | import java.time.Duration;
21 | import java.util.Collection;
22 | import java.util.List;
23 |
24 | public interface RqueueJobDao {
25 |
26 | void createJob(RqueueJob rqueueJob, Duration expiry);
27 |
28 | void save(RqueueJob rqueueJob, Duration expiry);
29 |
30 | RqueueJob findById(String jobId);
31 |
32 | List findJobsByIdIn(Collection jobIds);
33 |
34 | List finByMessageIdIn(List messageIds);
35 |
36 | List finByMessageId(String messageId);
37 |
38 | void delete(String jobId);
39 | }
40 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/dao/RqueueMessageMetadataDao.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.dao;
18 |
19 | import com.github.sonus21.rqueue.models.db.MessageMetadata;
20 | import java.time.Duration;
21 | import java.util.Collection;
22 | import java.util.List;
23 | import reactor.core.publisher.Mono;
24 |
25 | public interface RqueueMessageMetadataDao {
26 |
27 | MessageMetadata get(String id);
28 |
29 | List findAll(Collection ids);
30 |
31 | void save(MessageMetadata messageMetadata, Duration ttl);
32 |
33 | void delete(String id);
34 |
35 | void deleteAll(Collection ids);
36 |
37 | Mono saveReactive(MessageMetadata messageMetadata, Duration duration);
38 | }
39 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/dao/RqueueQStatsDao.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.dao;
18 |
19 | import com.github.sonus21.rqueue.models.db.QueueStatistics;
20 | import java.util.Collection;
21 | import java.util.List;
22 |
23 | public interface RqueueQStatsDao {
24 |
25 | QueueStatistics findById(String id);
26 |
27 | List findAll(Collection ids);
28 |
29 | void save(QueueStatistics queueStatistics);
30 | }
31 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/dao/RqueueSystemConfigDao.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.dao;
18 |
19 | import com.github.sonus21.rqueue.models.db.QueueConfig;
20 | import java.util.Collection;
21 | import java.util.List;
22 |
23 | public interface RqueueSystemConfigDao {
24 |
25 | QueueConfig getConfigByName(String name);
26 |
27 | List getConfigByNames(Collection names);
28 |
29 | QueueConfig getConfigByName(String name, boolean cached);
30 |
31 | QueueConfig getQConfig(String id, boolean cached);
32 |
33 | List findAllQConfig(Collection ids);
34 |
35 | void saveQConfig(QueueConfig queueConfig);
36 |
37 | void saveAllQConfig(List newConfigs);
38 |
39 | void clearCacheByName(String name);
40 | }
41 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/exception/LockCanNotBeAcquired.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.exception;
18 |
19 | /**
20 | * Whenever a lock can not be acquired cause some other process/thread is holding lock then this
21 | * error would be thrown. The application should retry once this error occurs.
22 | */
23 | public class LockCanNotBeAcquired extends RuntimeException {
24 |
25 | private static final long serialVersionUID = 598739372785907190L;
26 |
27 | public LockCanNotBeAcquired(String name) {
28 | super(name);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/exception/OverrideException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.exception;
18 |
19 | public class OverrideException extends RuntimeException {
20 |
21 | private static final long serialVersionUID = 598739372785907190L;
22 |
23 | public OverrideException(String name) {
24 | super(name);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/exception/ProcessingException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.exception;
18 |
19 | public class ProcessingException extends Exception {
20 |
21 | private static final long serialVersionUID = 9003794852942108696L;
22 | private final Object data;
23 |
24 | public ProcessingException(String message) {
25 | this(message, null);
26 | }
27 |
28 | public ProcessingException(String message, Object data) {
29 | super(message);
30 | this.data = null;
31 | }
32 |
33 | @Override
34 | public String toString() {
35 | if (data == null) {
36 | return super.toString();
37 | }
38 | return super.toString() + data;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/exception/QueueDoesNotExist.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.exception;
18 |
19 | /**
20 | * This exception is raised, when a queue is not registered in
21 | * {@link com.github.sonus21.rqueue.core.EndpointRegistry}, to register a queue use
22 | * {@link com.github.sonus21.rqueue.core.RqueueEndpointManager#registerQueue(String, String...)}
23 | */
24 | public class QueueDoesNotExist extends RuntimeException {
25 |
26 | private static final long serialVersionUID = 598739372785907190L;
27 |
28 | public QueueDoesNotExist(String name) {
29 | super(name);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/exception/TimedOutException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.exception;
18 |
19 | public class TimedOutException extends Exception {
20 |
21 | private static final long serialVersionUID = 132943639600997783L;
22 |
23 | public TimedOutException(String message) {
24 | super(message);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/exception/UnknownSwitchCase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.exception;
18 |
19 | public class UnknownSwitchCase extends RuntimeException {
20 |
21 | private static final long serialVersionUID = -363842614000049763L;
22 |
23 | public UnknownSwitchCase(String message) {
24 | super(message);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/metrics/RqueueCounter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.metrics;
18 |
19 | /**
20 | * Rqueue counter counts the different types of events related to a queue. It's used to count how
21 | * many messages have been processed and how many of them have been failed. In the case of failure
22 | * count increases.
23 | */
24 | public class RqueueCounter implements RqueueMetricsCounter {
25 |
26 | private final QueueCounter queueCounter;
27 |
28 | public RqueueCounter(QueueCounter queueCounter) {
29 | this.queueCounter = queueCounter;
30 | }
31 |
32 | @Override
33 | public void updateFailureCount(String queueName) {
34 | queueCounter.updateFailureCount(queueName);
35 | }
36 |
37 | @Override
38 | public void updateExecutionCount(String queueName) {
39 | queueCounter.updateExecutionCount(queueName);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/metrics/RqueueMetricsCounter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.metrics;
18 |
19 | public interface RqueueMetricsCounter {
20 |
21 | void updateFailureCount(String queueName);
22 |
23 | void updateExecutionCount(String queueName);
24 | }
25 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/metrics/RqueueMetricsRegistry.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.metrics;
18 |
19 | import com.github.sonus21.rqueue.models.event.RqueueBootstrapEvent;
20 | import org.springframework.context.ApplicationListener;
21 |
22 | public interface RqueueMetricsRegistry extends ApplicationListener {
23 |
24 | QueueCounter getQueueCounter();
25 | }
26 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/Concurrency.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models;
18 |
19 | import com.fasterxml.jackson.annotation.JsonIgnore;
20 | import lombok.AllArgsConstructor;
21 | import lombok.EqualsAndHashCode;
22 | import lombok.Getter;
23 |
24 | @Getter
25 | @AllArgsConstructor
26 | @EqualsAndHashCode(callSuper = true)
27 | public class Concurrency extends SerializableBase {
28 |
29 | private static final long serialVersionUID = 3165194419314698068L;
30 | private final int min;
31 | private final int max;
32 |
33 | public MinMax toMinMax() {
34 | return new MinMax<>(min, max);
35 | }
36 |
37 | @JsonIgnore
38 | public boolean isValid() {
39 | return min > 0;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/MessageMoveResult.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models;
18 |
19 | import lombok.AllArgsConstructor;
20 | import lombok.Getter;
21 |
22 | @Getter
23 | @AllArgsConstructor
24 | public class MessageMoveResult {
25 |
26 | private final int numberOfMessages;
27 | private final boolean success;
28 | }
29 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/MinMax.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models;
18 |
19 | import java.io.Serializable;
20 | import lombok.AllArgsConstructor;
21 | import lombok.EqualsAndHashCode;
22 | import lombok.Getter;
23 | import lombok.NoArgsConstructor;
24 | import lombok.Setter;
25 |
26 | @Getter
27 | @Setter
28 | @AllArgsConstructor
29 | @EqualsAndHashCode(callSuper = false)
30 | @NoArgsConstructor
31 | public class MinMax extends SerializableBase {
32 |
33 | private static final long serialVersionUID = 455990603344829053L;
34 | private T min;
35 | private T max;
36 | }
37 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/Pair.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models;
18 |
19 | import lombok.AllArgsConstructor;
20 | import lombok.Getter;
21 | import lombok.NoArgsConstructor;
22 | import lombok.Setter;
23 |
24 | @AllArgsConstructor
25 | @NoArgsConstructor
26 | @Setter
27 | @Getter
28 | public class Pair {
29 |
30 | private S first;
31 | private T second;
32 | }
33 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/PubSubMessage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models;
18 |
19 | import java.io.Serializable;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.NoArgsConstructor;
23 | import lombok.ToString;
24 |
25 | @Getter
26 | @NoArgsConstructor
27 | @ToString(callSuper = true)
28 | @EqualsAndHashCode(callSuper = true)
29 | public class PubSubMessage extends SerializableBase {
30 |
31 | private static final long serialVersionUID = 780914041036616260L;
32 | private String senderId;
33 | private Serializable data;
34 | }
35 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/SerializableBase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models;
18 |
19 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
20 | import com.fasterxml.jackson.annotation.JsonInclude;
21 | import com.fasterxml.jackson.annotation.JsonInclude.Include;
22 | import java.io.Serializable;
23 | import lombok.EqualsAndHashCode;
24 | import lombok.NoArgsConstructor;
25 |
26 | @JsonIgnoreProperties(ignoreUnknown = true)
27 | @NoArgsConstructor
28 | @EqualsAndHashCode
29 | @JsonInclude(Include.NON_NULL)
30 | public abstract class SerializableBase implements Serializable {
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/aggregator/TasksStat.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.aggregator;
18 |
19 | import com.github.sonus21.rqueue.models.db.JobRunTime;
20 | import lombok.ToString;
21 |
22 | @ToString
23 | public class TasksStat {
24 |
25 | public long discarded = 0;
26 | public long success = 0;
27 | public long movedToDlq = 0;
28 | public long retried = 0;
29 | public long jobCount;
30 | public long minExecution = Long.MAX_VALUE;
31 | public long maxExecution = 0;
32 | public long totalExecutionTime;
33 |
34 | public JobRunTime jobRunTime() {
35 | return new JobRunTime(minExecution, maxExecution, jobCount, totalExecutionTime);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/db/CheckinMessage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.db;
18 |
19 | import com.github.sonus21.rqueue.models.SerializableBase;
20 | import java.io.Serializable;
21 | import lombok.AllArgsConstructor;
22 | import lombok.EqualsAndHashCode;
23 | import lombok.Getter;
24 | import lombok.NoArgsConstructor;
25 | import lombok.Setter;
26 |
27 | @Getter
28 | @Setter
29 | @NoArgsConstructor
30 | @AllArgsConstructor
31 | @EqualsAndHashCode(callSuper = false)
32 | public class CheckinMessage extends SerializableBase {
33 |
34 | private static final long serialVersionUID = 4727068901984917510L;
35 | private Serializable message;
36 | private long at;
37 | }
38 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/db/DeadLetterQueue.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.db;
18 |
19 | import com.github.sonus21.rqueue.models.SerializableBase;
20 | import lombok.AllArgsConstructor;
21 | import lombok.EqualsAndHashCode;
22 | import lombok.Getter;
23 | import lombok.NoArgsConstructor;
24 | import lombok.Setter;
25 | import lombok.ToString;
26 |
27 | @Getter
28 | @Setter
29 | @AllArgsConstructor
30 | @NoArgsConstructor
31 | @EqualsAndHashCode(callSuper = false)
32 | @ToString
33 | public class DeadLetterQueue extends SerializableBase {
34 |
35 | private static final long serialVersionUID = 2632111672508854121L;
36 | private String name;
37 | private boolean consumerEnabled;
38 | }
39 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/db/Execution.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.db;
18 |
19 | import com.fasterxml.jackson.annotation.JsonIgnore;
20 | import com.github.sonus21.rqueue.models.SerializableBase;
21 | import com.github.sonus21.rqueue.models.enums.ExecutionStatus;
22 | import lombok.AllArgsConstructor;
23 | import lombok.EqualsAndHashCode;
24 | import lombok.Getter;
25 | import lombok.NoArgsConstructor;
26 | import lombok.Setter;
27 | import lombok.ToString;
28 |
29 | @AllArgsConstructor
30 | @NoArgsConstructor
31 | @Getter
32 | @Setter
33 | @EqualsAndHashCode(callSuper = true)
34 | @ToString(callSuper = true)
35 | public class Execution extends SerializableBase {
36 |
37 | private static final long serialVersionUID = 3893537050761142817L;
38 | private long startTime;
39 | private long endTime;
40 | private String error;
41 | @JsonIgnore
42 | private Throwable exception;
43 | private ExecutionStatus status;
44 | }
45 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/db/JobRunTime.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.db;
18 |
19 | import com.github.sonus21.rqueue.models.SerializableBase;
20 | import lombok.AllArgsConstructor;
21 | import lombok.EqualsAndHashCode;
22 | import lombok.Getter;
23 | import lombok.NoArgsConstructor;
24 | import lombok.Setter;
25 |
26 | @Getter
27 | @Setter
28 | @NoArgsConstructor
29 | @AllArgsConstructor
30 | @EqualsAndHashCode(callSuper = false)
31 | public class JobRunTime extends SerializableBase {
32 |
33 | private static final long serialVersionUID = 6219118148061766036L;
34 | private long min;
35 | private long max;
36 | private long jobCount;
37 | private long totalExecutionTime;
38 | }
39 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/enums/ActionType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.enums;
18 |
19 | public enum ActionType {
20 | DELETE,
21 | NONE
22 | }
23 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/enums/AggregationType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.enums;
18 |
19 | import lombok.AccessLevel;
20 | import lombok.AllArgsConstructor;
21 | import lombok.Getter;
22 |
23 | @AllArgsConstructor(access = AccessLevel.PRIVATE)
24 | @Getter
25 | public enum AggregationType {
26 | DAILY("Daily"),
27 | WEEKLY("Weekly"),
28 | MONTHLY("Monthly");
29 | private final String description;
30 | }
31 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/enums/ChartDataType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.enums;
18 |
19 | import java.util.Arrays;
20 | import java.util.List;
21 | import java.util.stream.Collectors;
22 | import lombok.AllArgsConstructor;
23 | import lombok.Getter;
24 |
25 | @AllArgsConstructor
26 | @Getter
27 | public enum ChartDataType {
28 | SUCCESSFUL("Successful execution", true),
29 | DISCARDED("Message discarded", true),
30 | MOVED_TO_DLQ("Moved to dead letter queue messages", true),
31 | RETRIED("Retried at least once", true),
32 | EXECUTION("Min Execution time", false);
33 | private final String description;
34 | private final boolean userView;
35 |
36 | public static List getActiveCharts() {
37 | return Arrays.stream(values()).filter(ChartDataType::isUserView).collect(Collectors.toList());
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/enums/ChartType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.enums;
18 |
19 | import lombok.AccessLevel;
20 | import lombok.AllArgsConstructor;
21 | import lombok.Getter;
22 |
23 | @AllArgsConstructor(access = AccessLevel.PRIVATE)
24 | @Getter
25 | public enum ChartType {
26 | LATENCY,
27 | STATS
28 | }
29 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/enums/ExecutionStatus.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.enums;
18 |
19 | public enum ExecutionStatus {
20 | IN_PROGRESS,
21 | SUCCESSFUL,
22 | THROTTLED,
23 | DELETED,
24 | FAILED,
25 | IGNORED,
26 | OLD_MESSAGE,
27 | QUEUE_INACTIVE,
28 | }
29 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/enums/JobStatus.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.enums;
18 |
19 | public enum JobStatus {
20 | UNKNOWN,
21 | CREATED,
22 | PROCESSING,
23 | FAILED,
24 | SUCCESS
25 | }
26 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/enums/NavTab.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.enums;
18 |
19 | import lombok.AccessLevel;
20 | import lombok.AllArgsConstructor;
21 | import lombok.Getter;
22 |
23 | @AllArgsConstructor(access = AccessLevel.PRIVATE)
24 | @Getter
25 | public enum NavTab {
26 | QUEUES("Queues"),
27 | DEAD("Dead"),
28 | RUNNING("Running"),
29 | PENDING("Pending"),
30 | SCHEDULED("Scheduled"),
31 | COMPLETED("Completed"),
32 | UTILITY("Utility");
33 | private final String description;
34 | }
35 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/enums/PriorityMode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.enums;
18 |
19 | public enum PriorityMode {
20 | STRICT,
21 | WEIGHTED
22 | }
23 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/enums/PubSubType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.enums;
18 |
19 | public enum PubSubType {
20 | PAUSE_QUEUE,
21 | QUEUE_CRUD;
22 | }
23 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/enums/RqueueMode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.enums;
18 |
19 | public enum RqueueMode {
20 | PRODUCER,
21 | CONSUMER,
22 | BOTH,
23 | }
24 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/enums/TableColumnType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.enums;
18 |
19 | public enum TableColumnType {
20 | DISPLAY,
21 | ACTION
22 | }
23 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/event/RqueueQueuePauseEvent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.event;
18 |
19 | import lombok.Getter;
20 | import org.springframework.context.ApplicationEvent;
21 |
22 | @Getter
23 | public class RqueueQueuePauseEvent extends ApplicationEvent {
24 |
25 | private final String queue;
26 |
27 | private final boolean paused;
28 |
29 | /**
30 | * Create a new ApplicationEvent.
31 | *
32 | * @param source the object on which the event initially occurred (never {@code null})
33 | * @param queue queue that's getting (un)paused
34 | * @param paused a boolean flag that indicates whether it's going to paused or otherwise
35 | */
36 | public RqueueQueuePauseEvent(Object source, String queue, boolean paused) {
37 | super(source);
38 | this.queue = queue;
39 | this.paused = paused;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/request/DataDeleteRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.request;
18 |
19 | import com.fasterxml.jackson.annotation.JsonProperty;
20 | import com.github.sonus21.rqueue.models.SerializableBase;
21 | import jakarta.validation.constraints.NotEmpty;
22 | import lombok.EqualsAndHashCode;
23 | import lombok.Getter;
24 | import lombok.NoArgsConstructor;
25 | import lombok.Setter;
26 | import lombok.ToString;
27 |
28 | @Getter
29 | @Setter
30 | @NoArgsConstructor
31 | @ToString
32 | @EqualsAndHashCode(callSuper = true)
33 | public class DataDeleteRequest extends SerializableBase {
34 |
35 | @JsonProperty("queue")
36 | @NotEmpty
37 | private String queueName;
38 |
39 | @JsonProperty("data_set")
40 | @NotEmpty
41 | private String datasetName;
42 | }
43 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/request/DataTypeRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.request;
18 |
19 | import com.github.sonus21.rqueue.models.SerializableBase;
20 | import jakarta.validation.constraints.NotEmpty;
21 | import lombok.AllArgsConstructor;
22 | import lombok.EqualsAndHashCode;
23 | import lombok.Getter;
24 | import lombok.NoArgsConstructor;
25 | import lombok.Setter;
26 | import lombok.ToString;
27 |
28 | @Getter
29 | @Setter
30 | @NoArgsConstructor
31 | @ToString
32 | @EqualsAndHashCode(callSuper = true)
33 | @AllArgsConstructor
34 | public class DataTypeRequest extends SerializableBase {
35 |
36 | @NotEmpty
37 | private String name;
38 | }
39 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/request/DateViewRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.request;
18 |
19 | import com.fasterxml.jackson.annotation.JsonProperty;
20 | import com.github.sonus21.rqueue.models.SerializableBase;
21 | import com.github.sonus21.rqueue.models.enums.DataType;
22 | import jakarta.validation.constraints.NotEmpty;
23 | import jakarta.validation.constraints.NotNull;
24 | import lombok.EqualsAndHashCode;
25 | import lombok.Getter;
26 | import lombok.NoArgsConstructor;
27 | import lombok.Setter;
28 | import lombok.ToString;
29 |
30 | @Getter
31 | @Setter
32 | @NoArgsConstructor
33 | @ToString
34 | @EqualsAndHashCode(callSuper = true)
35 | public class DateViewRequest extends SerializableBase {
36 |
37 | private @NotNull DataType type;
38 | private @NotEmpty String name;
39 | private String key;
40 |
41 | @JsonProperty("page")
42 | private int pageNumber = 0;
43 |
44 | @JsonProperty("count")
45 | private int itemPerPage = 20;
46 | }
47 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/request/MessageDeleteRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.request;
18 |
19 | import com.fasterxml.jackson.annotation.JsonProperty;
20 | import com.github.sonus21.rqueue.models.SerializableBase;
21 | import jakarta.validation.constraints.NotEmpty;
22 | import lombok.EqualsAndHashCode;
23 | import lombok.Getter;
24 | import lombok.NoArgsConstructor;
25 | import lombok.Setter;
26 | import lombok.ToString;
27 |
28 | @Getter
29 | @Setter
30 | @NoArgsConstructor
31 | @ToString
32 | @EqualsAndHashCode(callSuper = true)
33 | public class MessageDeleteRequest extends SerializableBase {
34 |
35 | @JsonProperty("queue")
36 | @NotEmpty
37 | private String queueName;
38 |
39 | @JsonProperty("message_id")
40 | @NotEmpty
41 | private String messageId;
42 | }
43 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/request/PauseUnpauseQueueRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.request;
18 |
19 | import lombok.AllArgsConstructor;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.NoArgsConstructor;
23 | import lombok.Setter;
24 |
25 | @Getter
26 | @Setter
27 | @NoArgsConstructor
28 | @EqualsAndHashCode(callSuper = true)
29 | @AllArgsConstructor
30 | public class PauseUnpauseQueueRequest extends DataTypeRequest {
31 |
32 | private boolean pause;
33 |
34 | @Override
35 | public String toString() {
36 | return "PauseUnpauseQueueRequest{" + "queue=" + getName() + ", pause=" + pause + '}';
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/request/QueueExploreRequest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.request;
18 |
19 | import com.fasterxml.jackson.annotation.JsonProperty;
20 | import com.github.sonus21.rqueue.models.SerializableBase;
21 | import com.github.sonus21.rqueue.models.enums.DataType;
22 | import jakarta.validation.constraints.NotEmpty;
23 | import jakarta.validation.constraints.NotNull;
24 | import lombok.EqualsAndHashCode;
25 | import lombok.Getter;
26 | import lombok.NoArgsConstructor;
27 | import lombok.Setter;
28 | import lombok.ToString;
29 |
30 | @Getter
31 | @Setter
32 | @NoArgsConstructor
33 | @ToString
34 | @EqualsAndHashCode(callSuper = true)
35 | public class QueueExploreRequest extends SerializableBase {
36 |
37 | private @NotNull DataType type;
38 | private @NotEmpty String name;
39 | private @NotEmpty String src;
40 |
41 | @JsonProperty("page")
42 | private int pageNumber = 0;
43 |
44 | @JsonProperty("count")
45 | private int itemPerPage = 20;
46 | }
47 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/response/Action.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.response;
18 |
19 | import com.github.sonus21.rqueue.models.SerializableBase;
20 | import com.github.sonus21.rqueue.models.enums.ActionType;
21 | import lombok.AllArgsConstructor;
22 | import lombok.EqualsAndHashCode;
23 | import lombok.Getter;
24 | import lombok.NoArgsConstructor;
25 | import lombok.Setter;
26 | import lombok.ToString;
27 |
28 | @Getter
29 | @Setter
30 | @AllArgsConstructor
31 | @NoArgsConstructor
32 | @ToString
33 | @EqualsAndHashCode(callSuper = true)
34 | public class Action extends SerializableBase {
35 |
36 | private static final long serialVersionUID = 7809140410366162600L;
37 | private ActionType type;
38 | private String description;
39 | }
40 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/response/BaseResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.response;
18 |
19 | import com.fasterxml.jackson.annotation.JsonIgnore;
20 | import com.github.sonus21.rqueue.models.SerializableBase;
21 | import lombok.AllArgsConstructor;
22 | import lombok.Builder;
23 | import lombok.EqualsAndHashCode;
24 | import lombok.Getter;
25 | import lombok.NoArgsConstructor;
26 | import lombok.Setter;
27 | import lombok.ToString;
28 |
29 | @AllArgsConstructor
30 | @NoArgsConstructor
31 | @Getter
32 | @Setter
33 | @ToString
34 | @EqualsAndHashCode(callSuper = false)
35 | @Builder
36 | public class BaseResponse extends SerializableBase {
37 |
38 | private static final long serialVersionUID = 4830863373464370840L;
39 | private int code;
40 | private String message;
41 |
42 | @JsonIgnore
43 | public void set(int code, String message) {
44 | this.code = code;
45 | this.message = message;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/response/BooleanResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.response;
18 |
19 | import lombok.AllArgsConstructor;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.NoArgsConstructor;
23 | import lombok.Setter;
24 | import lombok.ToString;
25 |
26 | @Getter
27 | @AllArgsConstructor
28 | @NoArgsConstructor
29 | @Setter
30 | @ToString(callSuper = true)
31 | @EqualsAndHashCode(callSuper = true)
32 | public class BooleanResponse extends BaseResponse {
33 |
34 | private static final long serialVersionUID = 3137908352960413849L;
35 | private boolean value;
36 | }
37 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/response/ChartDataResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.response;
18 |
19 | import com.fasterxml.jackson.annotation.JsonProperty;
20 | import java.io.Serializable;
21 | import java.util.List;
22 | import lombok.Getter;
23 | import lombok.NoArgsConstructor;
24 | import lombok.Setter;
25 | import lombok.ToString;
26 |
27 | @Getter
28 | @Setter
29 | @ToString(callSuper = true)
30 | @SuppressWarnings("java:S2160")
31 | @NoArgsConstructor
32 | public class ChartDataResponse extends BaseResponse {
33 |
34 | private static final long serialVersionUID = -7881568871822217801L;
35 | private List> data;
36 | private String title;
37 |
38 | @JsonProperty("hTitle")
39 | private String hTitle;
40 |
41 | @JsonProperty("vTitle")
42 | private String vTitle;
43 | }
44 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/response/DataSelectorResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.response;
18 |
19 | import com.github.sonus21.rqueue.models.Pair;
20 | import java.util.List;
21 | import lombok.AllArgsConstructor;
22 | import lombok.Getter;
23 | import lombok.NoArgsConstructor;
24 | import lombok.Setter;
25 | import lombok.ToString;
26 |
27 | @Getter
28 | @Setter
29 | @ToString(callSuper = true)
30 | @SuppressWarnings("java:S2160")
31 | @NoArgsConstructor
32 | @AllArgsConstructor
33 | public class DataSelectorResponse extends BaseResponse {
34 |
35 | private String title;
36 | private List> data;
37 | }
38 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/response/MessageMoveResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.response;
18 |
19 | import lombok.AllArgsConstructor;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.NoArgsConstructor;
23 | import lombok.Setter;
24 | import lombok.ToString;
25 |
26 | @Getter
27 | @NoArgsConstructor
28 | @Setter
29 | @ToString(callSuper = true)
30 | @AllArgsConstructor
31 | @EqualsAndHashCode(callSuper = true)
32 | public class MessageMoveResponse extends BooleanResponse {
33 |
34 | private static final long serialVersionUID = 4070425131282033429L;
35 | private int numberOfMessageTransferred;
36 | }
37 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/response/RedisDataDetail.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.response;
18 |
19 | import com.github.sonus21.rqueue.models.SerializableBase;
20 | import com.github.sonus21.rqueue.models.enums.DataType;
21 | import lombok.AllArgsConstructor;
22 | import lombok.EqualsAndHashCode;
23 | import lombok.Getter;
24 | import lombok.NoArgsConstructor;
25 | import lombok.Setter;
26 | import lombok.ToString;
27 |
28 | @Getter
29 | @Setter
30 | @AllArgsConstructor
31 | @NoArgsConstructor
32 | @ToString(callSuper = true)
33 | @EqualsAndHashCode(callSuper = false)
34 | public class RedisDataDetail extends SerializableBase {
35 |
36 | private static final long serialVersionUID = 1056616946630817927L;
37 | private String name;
38 | private DataType type;
39 | private long size;
40 | }
41 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/response/RowColumnMeta.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.response;
18 |
19 | import com.github.sonus21.rqueue.models.SerializableBase;
20 | import java.io.Serializable;
21 | import lombok.AllArgsConstructor;
22 | import lombok.EqualsAndHashCode;
23 | import lombok.Getter;
24 | import lombok.NoArgsConstructor;
25 | import lombok.ToString;
26 |
27 | @Getter
28 | @AllArgsConstructor
29 | @ToString(callSuper = true)
30 | @EqualsAndHashCode(callSuper = true)
31 | @NoArgsConstructor
32 | public class RowColumnMeta extends SerializableBase {
33 |
34 | private static final long serialVersionUID = 7727947329124106340L;
35 | private RowColumnMetaType type;
36 | private Serializable data;
37 |
38 | public RowColumnMeta(RowColumnMetaType type) {
39 | this(type, null);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/response/RowColumnMetaType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.response;
18 |
19 | public enum RowColumnMetaType {
20 | JOBS_BUTTON
21 | }
22 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/response/StringResponse.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.response;
18 |
19 | import lombok.AllArgsConstructor;
20 | import lombok.EqualsAndHashCode;
21 | import lombok.Getter;
22 | import lombok.NoArgsConstructor;
23 | import lombok.Setter;
24 | import lombok.ToString;
25 |
26 | @Getter
27 | @Setter
28 | @AllArgsConstructor
29 | @EqualsAndHashCode(callSuper = true)
30 | @ToString(callSuper = true)
31 | @NoArgsConstructor
32 | public class StringResponse extends BaseResponse {
33 |
34 | private static final long serialVersionUID = -5110084277095370843L;
35 | private String val;
36 | }
37 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/models/response/Table.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.models.response;
18 |
19 | import java.util.List;
20 | import lombok.AllArgsConstructor;
21 | import lombok.EqualsAndHashCode;
22 | import lombok.Getter;
23 | import lombok.NoArgsConstructor;
24 | import lombok.Setter;
25 | import lombok.ToString;
26 |
27 | @Getter
28 | @Setter
29 | @AllArgsConstructor
30 | @NoArgsConstructor
31 | @ToString(callSuper = true)
32 | @EqualsAndHashCode(callSuper = true)
33 | public class Table extends BaseResponse {
34 |
35 | private static final long serialVersionUID = -7188146334911288456L;
36 | private List headers;
37 | private List rows;
38 | }
39 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/utils/ExceptionUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.utils;
18 |
19 | import java.io.PrintWriter;
20 | import java.io.StringWriter;
21 |
22 | public final class ExceptionUtils {
23 |
24 | private ExceptionUtils() {
25 | }
26 |
27 | public static String getTraceback(Throwable e, int maxLength) {
28 | if (e == null) {
29 | return null;
30 | }
31 | StringWriter sw = new StringWriter();
32 | PrintWriter pw = new PrintWriter(sw);
33 | e.printStackTrace(pw);
34 | String stacktrace = sw.toString();
35 | if (stacktrace.length() > maxLength + 3) {
36 | stacktrace = stacktrace.substring(0, maxLength) + "...";
37 | }
38 | return stacktrace;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/utils/PriorityUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.utils;
18 |
19 | import java.util.HashSet;
20 | import java.util.Map;
21 | import java.util.Set;
22 |
23 | public final class PriorityUtils {
24 |
25 | private PriorityUtils() {
26 | }
27 |
28 | public static Set getNamesFromPriority(String queueName, Map priority) {
29 | Set keys = new HashSet<>();
30 | for (String key : priority.keySet()) {
31 | if (!key.equals(Constants.DEFAULT_PRIORITY_KEY)) {
32 | keys.add(getQueueNameForPriority(queueName, key));
33 | }
34 | }
35 | return keys;
36 | }
37 |
38 | public static String getQueueNameForPriority(String queueName, String priority) {
39 | Validator.validateQueue(queueName);
40 | Validator.validatePriority(priority);
41 | return queueName + getSuffix(priority);
42 | }
43 |
44 | public static String getSuffix(String priority) {
45 | return "_" + priority;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/utils/SerializationUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.utils;
18 |
19 | import com.fasterxml.jackson.databind.DeserializationFeature;
20 | import com.fasterxml.jackson.databind.ObjectMapper;
21 |
22 | public final class SerializationUtils {
23 |
24 | public static final byte[] EMPTY_ARRAY = new byte[0];
25 |
26 | private SerializationUtils() {
27 | }
28 |
29 | public static boolean isEmpty(byte[] bytes) {
30 | return bytes == null || bytes.length == 0;
31 | }
32 |
33 | public static boolean isJson(String data) {
34 | return !StringUtils.isEmpty(data)
35 | && data.charAt(0) == '{'
36 | && data.charAt(data.length() - 1) == '}';
37 | }
38 |
39 | public static ObjectMapper createObjectMapper() {
40 | ObjectMapper mapper = new ObjectMapper();
41 | mapper = mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
42 | return mapper;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/utils/condition/ReactiveDisabled.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.utils.condition;
18 |
19 | import org.springframework.context.annotation.Condition;
20 | import org.springframework.context.annotation.ConditionContext;
21 | import org.springframework.core.type.AnnotatedTypeMetadata;
22 |
23 | public class ReactiveDisabled implements Condition {
24 |
25 | @Override
26 | public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
27 | Boolean reactiveEnabled =
28 | context.getEnvironment().getProperty("rqueue.reactive.enabled", Boolean.class);
29 | return !Boolean.TRUE.equals(reactiveEnabled);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/utils/condition/ReactiveEnabled.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.utils.condition;
18 |
19 | import org.springframework.context.annotation.Condition;
20 | import org.springframework.context.annotation.ConditionContext;
21 | import org.springframework.core.type.AnnotatedTypeMetadata;
22 |
23 | public class ReactiveEnabled implements Condition {
24 |
25 | @Override
26 | public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
27 | Boolean reactiveEnabled =
28 | context.getEnvironment().getProperty("rqueue.reactive.enabled", Boolean.class);
29 | return Boolean.TRUE.equals(reactiveEnabled);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/utils/condition/RqueueEnabled.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.utils.condition;
18 |
19 | import org.springframework.context.annotation.Condition;
20 | import org.springframework.context.annotation.ConditionContext;
21 | import org.springframework.core.type.AnnotatedTypeMetadata;
22 |
23 | public class RqueueEnabled implements Condition {
24 |
25 | @Override
26 | public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
27 | Boolean enabled = context.getEnvironment().getProperty("rqueue.enabled", Boolean.class);
28 | return enabled == null || Boolean.TRUE.equals(enabled);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/utils/pebble/DateTimeFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.utils.pebble;
18 |
19 | import com.github.sonus21.rqueue.utils.DateTimeUtils;
20 | import io.pebbletemplates.pebble.extension.Function;
21 | import io.pebbletemplates.pebble.template.EvaluationContext;
22 | import io.pebbletemplates.pebble.template.PebbleTemplate;
23 | import java.util.Collections;
24 | import java.util.List;
25 | import java.util.Map;
26 |
27 | public class DateTimeFunction implements Function {
28 |
29 | public static final String FUNCTION_NAME = "time";
30 |
31 | @Override
32 | public Object execute(
33 | Map args, PebbleTemplate self, EvaluationContext context, int lineNumber) {
34 | Long milli = (Long) args.get("milli");
35 | return DateTimeUtils.formatMilliToString(milli);
36 | }
37 |
38 | @Override
39 | public List getArgumentNames() {
40 | return Collections.singletonList("milli");
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/utils/pebble/DefaultFunction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.utils.pebble;
18 |
19 | import io.pebbletemplates.pebble.extension.Function;
20 | import io.pebbletemplates.pebble.template.EvaluationContext;
21 | import io.pebbletemplates.pebble.template.PebbleTemplate;
22 | import java.util.Arrays;
23 | import java.util.List;
24 | import java.util.Map;
25 |
26 | public class DefaultFunction implements Function {
27 |
28 | public static final String FUNCTION_NAME = "default";
29 |
30 | @Override
31 | public Object execute(
32 | Map args, PebbleTemplate self, EvaluationContext context, int lineNumber) {
33 | Object src = args.get("src");
34 | Object dst = args.get("dst");
35 | if (src == null) {
36 | return dst;
37 | }
38 | return src;
39 | }
40 |
41 | @Override
42 | public List getArgumentNames() {
43 | return Arrays.asList("src", "dst");
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/utils/pebble/RqueuePebbleExtension.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.utils.pebble;
18 |
19 | import io.pebbletemplates.pebble.extension.AbstractExtension;
20 | import io.pebbletemplates.pebble.extension.Function;
21 | import java.util.HashMap;
22 | import java.util.Map;
23 |
24 | public class RqueuePebbleExtension extends AbstractExtension {
25 |
26 | @Override
27 | public Map getFunctions() {
28 | Map map = new HashMap<>();
29 | map.put(DeadLetterQueuesFunction.FUNCTION_NAME, new DeadLetterQueuesFunction());
30 | map.put(DateTimeFunction.FUNCTION_NAME, new DateTimeFunction());
31 | map.put(DefaultFunction.FUNCTION_NAME, new DefaultFunction());
32 | return map;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/web/controller/BaseController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.web.controller;
18 |
19 | import com.github.sonus21.rqueue.config.RqueueWebConfig;
20 | import jakarta.servlet.http.HttpServletResponse;
21 |
22 | public class BaseController {
23 |
24 | private final RqueueWebConfig rqueueWebConfig;
25 |
26 | public BaseController(RqueueWebConfig rqueueWebConfig) {
27 | this.rqueueWebConfig = rqueueWebConfig;
28 | }
29 |
30 | protected boolean isEnable(HttpServletResponse response) {
31 | if (!rqueueWebConfig.isEnable()) {
32 | response.setStatus(HttpServletResponse.SC_SERVICE_UNAVAILABLE);
33 | }
34 | return rqueueWebConfig.isEnable();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/web/controller/BaseReactiveController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.web.controller;
18 |
19 | import com.github.sonus21.rqueue.config.RqueueWebConfig;
20 | import org.springframework.http.HttpStatus;
21 | import org.springframework.http.server.reactive.ServerHttpResponse;
22 |
23 | public class BaseReactiveController {
24 |
25 | protected final RqueueWebConfig rqueueWebConfig;
26 |
27 | public BaseReactiveController(RqueueWebConfig rqueueWebConfig) {
28 | this.rqueueWebConfig = rqueueWebConfig;
29 | }
30 |
31 | protected boolean isEnabled(ServerHttpResponse response) {
32 | if (!rqueueWebConfig.isEnable()) {
33 | response.setStatusCode(HttpStatus.SERVICE_UNAVAILABLE);
34 | }
35 | return rqueueWebConfig.isEnable();
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/web/service/RqueueDashboardChartService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.web.service;
18 |
19 | import com.github.sonus21.rqueue.models.request.ChartDataRequest;
20 | import com.github.sonus21.rqueue.models.response.ChartDataResponse;
21 | import reactor.core.publisher.Mono;
22 |
23 | public interface RqueueDashboardChartService {
24 |
25 | ChartDataResponse getDashboardChartData(ChartDataRequest chartDataRequest);
26 |
27 | Mono getReactiveDashBoardData(ChartDataRequest chartDataRequest);
28 | }
29 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/web/service/RqueueJobService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.web.service;
18 |
19 | import com.github.sonus21.rqueue.exception.ProcessingException;
20 | import com.github.sonus21.rqueue.models.response.DataViewResponse;
21 | import reactor.core.publisher.Mono;
22 |
23 | public interface RqueueJobService {
24 |
25 | DataViewResponse getJobs(String messageId) throws ProcessingException;
26 |
27 | Mono getReactiveJobs(String messageId) throws ProcessingException;
28 | }
29 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/web/service/RqueueSystemManagerService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.web.service;
18 |
19 | import com.github.sonus21.rqueue.models.db.QueueConfig;
20 | import com.github.sonus21.rqueue.models.event.RqueueBootstrapEvent;
21 | import com.github.sonus21.rqueue.models.response.BaseResponse;
22 | import java.util.Collection;
23 | import java.util.List;
24 | import org.springframework.context.ApplicationListener;
25 | import reactor.core.publisher.Mono;
26 |
27 | public interface RqueueSystemManagerService extends ApplicationListener {
28 |
29 | BaseResponse deleteQueue(String queueName);
30 |
31 | List getQueues();
32 |
33 | List getQueueConfigs(Collection queues);
34 |
35 | List getQueueConfigs();
36 |
37 | List getSortedQueueConfigs();
38 |
39 | QueueConfig getQueueConfig(String queueName);
40 |
41 | Mono deleteReactiveQueue(String queueName);
42 | }
43 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/java/com/github/sonus21/rqueue/web/service/RqueueViewControllerService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.web.service;
18 |
19 | import org.springframework.ui.Model;
20 |
21 | public interface RqueueViewControllerService {
22 |
23 | void index(Model model, String forwardedFor);
24 |
25 | void queues(Model model, String xForwardedPrefix);
26 |
27 | void queueDetail(Model model, String xForwardedPrefix, String queueName);
28 |
29 | void running(Model model, String xForwardedPrefix);
30 |
31 | void scheduled(Model model, String xForwardedPrefix);
32 |
33 | void dead(Model model, String xForwardedPrefix);
34 |
35 | void pending(Model model, String xForwardedPrefix);
36 |
37 | void utility(Model model, String xForwardedPrefix);
38 | }
39 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/public/rqueue/img/android-chrome-192x192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sonus21/rqueue/f04317b2155b4bd43460536296a1f3c4f0a4f8be/rqueue-core/src/main/resources/public/rqueue/img/android-chrome-192x192.png
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/public/rqueue/img/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sonus21/rqueue/f04317b2155b4bd43460536296a1f3c4f0a4f8be/rqueue-core/src/main/resources/public/rqueue/img/apple-touch-icon.png
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/public/rqueue/img/favicon-16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sonus21/rqueue/f04317b2155b4bd43460536296a1f3c4f0a4f8be/rqueue-core/src/main/resources/public/rqueue/img/favicon-16x16.png
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/public/rqueue/img/favicon-32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sonus21/rqueue/f04317b2155b4bd43460536296a1f3c4f0a4f8be/rqueue-core/src/main/resources/public/rqueue/img/favicon-32x32.png
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/public/rqueue/img/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sonus21/rqueue/f04317b2155b4bd43460536296a1f3c4f0a4f8be/rqueue-core/src/main/resources/public/rqueue/img/favicon.ico
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/public/rqueue/vendor/boxicons/css/transformations.css:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | .bx-rotate-90 {
18 | transform: rotate(90deg);
19 |
20 | -ms-filter: 'progid:DXImageTransform.Microsoft.BasicImage(rotation=1)';
21 | }
22 |
23 | .bx-rotate-180 {
24 | transform: rotate(180deg);
25 |
26 | -ms-filter: 'progid:DXImageTransform.Microsoft.BasicImage(rotation=2)';
27 | }
28 |
29 | .bx-rotate-270 {
30 | transform: rotate(270deg);
31 |
32 | -ms-filter: 'progid:DXImageTransform.Microsoft.BasicImage(rotation=3)';
33 | }
34 |
35 | .bx-flip-horizontal {
36 | transform: scaleX(-1);
37 |
38 | -ms-filter: 'progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)';
39 | }
40 |
41 | .bx-flip-vertical {
42 | transform: scaleY(-1);
43 |
44 | -ms-filter: 'progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)';
45 | }
46 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/public/rqueue/vendor/boxicons/fonts/boxicons.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sonus21/rqueue/f04317b2155b4bd43460536296a1f3c4f0a4f8be/rqueue-core/src/main/resources/public/rqueue/vendor/boxicons/fonts/boxicons.eot
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/public/rqueue/vendor/boxicons/fonts/boxicons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sonus21/rqueue/f04317b2155b4bd43460536296a1f3c4f0a4f8be/rqueue-core/src/main/resources/public/rqueue/vendor/boxicons/fonts/boxicons.ttf
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/public/rqueue/vendor/boxicons/fonts/boxicons.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sonus21/rqueue/f04317b2155b4bd43460536296a1f3c4f0a4f8be/rqueue-core/src/main/resources/public/rqueue/vendor/boxicons/fonts/boxicons.woff
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/public/rqueue/vendor/boxicons/fonts/boxicons.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sonus21/rqueue/f04317b2155b4bd43460536296a1f3c4f0a4f8be/rqueue-core/src/main/resources/public/rqueue/vendor/boxicons/fonts/boxicons.woff2
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/rqueue/scripts/delete_if_same.lua:
--------------------------------------------------------------------------------
1 | -- Copyright (c) 2021 Sonu Kumar
2 | --
3 | -- Licensed under the Apache License, Version 2.0 (the "License");
4 | -- you may not use this file except in compliance with the License.
5 | -- You may obtain a copy of the License at
6 | --
7 | -- https://www.apache.org/licenses/LICENSE-2.0
8 | --
9 | -- Unless required by applicable law or agreed to in writing, software
10 | -- distributed under the License is distributed on an "AS IS" BASIS,
11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | -- See the License for the specific language governing permissions and limitations under the License.
13 | --
14 |
15 | -- get current value
16 | local value = redis.call('GET', KEYS[1])
17 | if not value then
18 | return true
19 | end
20 | if value == ARGV[1] then
21 | local val = redis.call('DEL', KEYS[1])
22 | if val == 1 then
23 | return true
24 | end
25 | end
26 | return false
27 |
28 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/rqueue/scripts/dequeue_message.lua:
--------------------------------------------------------------------------------
1 | -- Copyright (c) 2021 Sonu Kumar
2 | --
3 | -- Licensed under the Apache License, Version 2.0 (the "License");
4 | -- you may not use this file except in compliance with the License.
5 | -- You may obtain a copy of the License at
6 | --
7 | -- https://www.apache.org/licenses/LICENSE-2.0
8 | --
9 | -- Unless required by applicable law or agreed to in writing, software
10 | -- distributed under the License is distributed on an "AS IS" BASIS,
11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | -- See the License for the specific language governing permissions and limitations under the License.
13 | --
14 |
15 | -- get head of queue
16 | local values = redis.call('LRANGE', KEYS[1], 0, tonumber(ARGV[3]) - 1)
17 |
18 | if #values > 0 then
19 | for _, value in ipairs(values) do
20 | -- push to processing set
21 | redis.call('ZADD', KEYS[2], ARGV[2], value)
22 | -- remove from the queue
23 | redis.call('LPOP', KEYS[1])
24 | end
25 | end ;
26 |
27 | --if elements with lower priority are on the head of processing queue
28 | local v = redis.call('ZRANGE', KEYS[2], 0, 0, 'WITHSCORES')
29 | if v[1] ~= nil and tonumber(v[2]) < tonumber(ARGV[1]) then
30 | redis.call('PUBLISH', KEYS[3], v[2])
31 | end
32 | return values;
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/rqueue/scripts/enqueue_message.lua:
--------------------------------------------------------------------------------
1 | -- Copyright (c) 2021 Sonu Kumar
2 | --
3 | -- Licensed under the Apache License, Version 2.0 (the "License");
4 | -- you may not use this file except in compliance with the License.
5 | -- You may obtain a copy of the License at
6 | --
7 | -- https://www.apache.org/licenses/LICENSE-2.0
8 | --
9 | -- Unless required by applicable law or agreed to in writing, software
10 | -- distributed under the License is distributed on an "AS IS" BASIS,
11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | -- See the License for the specific language governing permissions and limitations under the License.
13 | --
14 |
15 | local count = redis.call('ZADD', KEYS[1], ARGV[2], ARGV[1])
16 | --if elements with lower priority are on head
17 | local v = redis.call('ZRANGE', KEYS[1], 0, 0, 'WITHSCORES')
18 | if v[1] ~= nil and tonumber(v[2]) < tonumber(ARGV[3]) then
19 | redis.call('PUBLISH', KEYS[2], v[2])
20 | end
21 | return count;
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/rqueue/scripts/move_message_list.lua:
--------------------------------------------------------------------------------
1 | -- Copyright (c) 2021-2023 Sonu Kumar
2 | --
3 | -- Licensed under the Apache License, Version 2.0 (the "License");
4 | -- you may not use this file except in compliance with the License.
5 | -- You may obtain a copy of the License at
6 | --
7 | -- https://www.apache.org/licenses/LICENSE-2.0
8 | --
9 | -- Unless required by applicable law or agreed to in writing, software
10 | -- distributed under the License is distributed on an "AS IS" BASIS,
11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | -- See the License for the specific language governing permissions and limitations under the License.
13 | --
14 |
15 | local score = redis.call('ZSCORE', KEYS[1], ARGV[1])
16 | if score then
17 | redis.call('RPUSH', KEYS[2], ARGV[2])
18 | redis.call('ZREM', KEYS[1], ARGV[1])
19 | end
20 | score = tonumber(score)
21 | return score
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/rqueue/scripts/move_message_list_to_list.lua:
--------------------------------------------------------------------------------
1 | -- Copyright (c) 2021-2023 Sonu Kumar
2 | --
3 | -- Licensed under the Apache License, Version 2.0 (the "License");
4 | -- you may not use this file except in compliance with the License.
5 | -- You may obtain a copy of the License at
6 | --
7 | -- https://www.apache.org/licenses/LICENSE-2.0
8 | --
9 | -- Unless required by applicable law or agreed to in writing, software
10 | -- distributed under the License is distributed on an "AS IS" BASIS,
11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | -- See the License for the specific language governing permissions and limitations under the License.
13 | --
14 |
15 | for i = tonumber(ARGV[1]), 1, -1
16 | do
17 | local msg = redis.call('LRANGE', KEYS[1], 0, 0)[1]
18 | if msg ~= nil then
19 | redis.call("RPUSH", KEYS[2], msg)
20 | redis.call("LPOP", KEYS[1])
21 | else
22 | break
23 | end
24 | end
25 | local remainingMessage = redis.call("LLEN", KEYS[1])
26 | return remainingMessage
27 |
28 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/rqueue/scripts/move_message_list_to_zset.lua:
--------------------------------------------------------------------------------
1 | -- Copyright (c) 2021-2023 Sonu Kumar
2 | --
3 | -- Licensed under the Apache License, Version 2.0 (the "License");
4 | -- you may not use this file except in compliance with the License.
5 | -- You may obtain a copy of the License at
6 | --
7 | -- https://www.apache.org/licenses/LICENSE-2.0
8 | --
9 | -- Unless required by applicable law or agreed to in writing, software
10 | -- distributed under the License is distributed on an "AS IS" BASIS,
11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | -- See the License for the specific language governing permissions and limitations under the License.
13 | --
14 |
15 | for i = tonumber(ARGV[1]), 1, -1
16 | do
17 | local msg = redis.call('LRANGE', KEYS[1], 0, 0)[1]
18 | if msg ~= nil then
19 | redis.call("ZADD", KEYS[2], ARGV[2], msg)
20 | redis.call("LPOP", KEYS[1])
21 | else
22 | break
23 | end
24 | end
25 | local remainingMessage = redis.call("LLEN", KEYS[1])
26 | return remainingMessage
27 |
28 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/rqueue/scripts/move_message_zset.lua:
--------------------------------------------------------------------------------
1 | -- Copyright (c) 2021-2023 Sonu Kumar
2 | --
3 | -- Licensed under the Apache License, Version 2.0 (the "License");
4 | -- you may not use this file except in compliance with the License.
5 | -- You may obtain a copy of the License at
6 | --
7 | -- https://www.apache.org/licenses/LICENSE-2.0
8 | --
9 | -- Unless required by applicable law or agreed to in writing, software
10 | -- distributed under the License is distributed on an "AS IS" BASIS,
11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | -- See the License for the specific language governing permissions and limitations under the License.
13 | --
14 |
15 | local score = redis.call('ZSCORE', KEYS[1], ARGV[1])
16 | if score then
17 | redis.call('ZADD', KEYS[2], ARGV[3], ARGV[2])
18 | redis.call('ZREM', KEYS[1], ARGV[1])
19 | end
20 | score = tonumber(score)
21 | return score
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/rqueue/scripts/move_message_zset_to_list.lua:
--------------------------------------------------------------------------------
1 | -- Copyright (c) 2021-2023 Sonu Kumar
2 | --
3 | -- Licensed under the Apache License, Version 2.0 (the "License");
4 | -- you may not use this file except in compliance with the License.
5 | -- You may obtain a copy of the License at
6 | --
7 | -- https://www.apache.org/licenses/LICENSE-2.0
8 | --
9 | -- Unless required by applicable law or agreed to in writing, software
10 | -- distributed under the License is distributed on an "AS IS" BASIS,
11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | -- See the License for the specific language governing permissions and limitations under the License.
13 | --
14 |
15 | for i = tonumber(ARGV[1]), 1, -1
16 | do
17 | local msg = redis.call('ZRANGE', KEYS[1], 0, 0, 'WITHSCORES')[1]
18 | if msg ~= nil then
19 | redis.call('RPUSH', KEYS[2], msg)
20 | redis.call('ZREM', KEYS[1], msg)
21 | else
22 | break
23 | end
24 | end
25 | local size = redis.call('ZCARD', KEYS[1])
26 | return size
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/rqueue/scripts/move_message_zset_to_zset.lua:
--------------------------------------------------------------------------------
1 | -- Copyright (c) 2021-2023 Sonu Kumar
2 | --
3 | -- Licensed under the Apache License, Version 2.0 (the "License");
4 | -- you may not use this file except in compliance with the License.
5 | -- You may obtain a copy of the License at
6 | --
7 | -- https://www.apache.org/licenses/LICENSE-2.0
8 | --
9 | -- Unless required by applicable law or agreed to in writing, software
10 | -- distributed under the License is distributed on an "AS IS" BASIS,
11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | -- See the License for the specific language governing permissions and limitations under the License.
13 | --
14 |
15 | local srcValues = redis.call('ZRANGE', KEYS[1], 0, ARGV[1])
16 | if #srcValues > 0 then
17 | local delta = tonumber(ARGV[2])
18 | local op = tonumber(ARGV[3])
19 | for existing_score, v in ipairs(srcValues) do
20 | local score = delta
21 | if op == 0 then
22 | score = score + existing_score
23 | end
24 | redis.call('ZADD', KEYS[2], score, v)
25 | end
26 | redis.call('ZREM', KEYS[1], unpack(srcValues))
27 | end ;
28 | local size = redis.call('ZCARD', KEYS[1])
29 | return size
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/rqueue/scripts/schedule_message.lua:
--------------------------------------------------------------------------------
1 | -- Copyright (c) 2021-2023 Sonu Kumar
2 | --
3 | -- Licensed under the Apache License, Version 2.0 (the "License");
4 | -- you may not use this file except in compliance with the License.
5 | -- You may obtain a copy of the License at
6 | --
7 | -- https://www.apache.org/licenses/LICENSE-2.0
8 | --
9 | -- Unless required by applicable law or agreed to in writing, software
10 | -- distributed under the License is distributed on an "AS IS" BASIS,
11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | -- See the License for the specific language governing permissions and limitations under the License.
13 | --
14 |
15 | -- get current value
16 | local value = redis.call('GET', KEYS[1])
17 | if value then
18 | return 0
19 | end
20 | redis.call('SET', KEYS[1], '1', 'EX', ARGV[1])
21 | redis.call('ZADD', KEYS[2], ARGV[3], ARGV[2])
22 | return 1
23 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/rqueue/scripts/score_updater.lua:
--------------------------------------------------------------------------------
1 | -- Copyright (c) 2021-2023 Sonu Kumar
2 | --
3 | -- Licensed under the Apache License, Version 2.0 (the "License");
4 | -- you may not use this file except in compliance with the License.
5 | -- You may obtain a copy of the License at
6 | --
7 | -- https://www.apache.org/licenses/LICENSE-2.0
8 | --
9 | -- Unless required by applicable law or agreed to in writing, software
10 | -- distributed under the License is distributed on an "AS IS" BASIS,
11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | -- See the License for the specific language governing permissions and limitations under the License.
13 | --
14 |
15 | local score = redis.call('ZSCORE', KEYS[1], ARGV[1])
16 | if score then
17 | redis.call('ZADD', KEYS[1], tonumber(ARGV[2]) + tonumber(score), ARGV[1])
18 | return true
19 | end
20 | return false
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/templates/rqueue/index.html:
--------------------------------------------------------------------------------
1 | {% extends 'base' %}
2 | {% block main %}
3 | {% include 'stats_chart' %}
4 |
19 |
20 |
21 | {% include 'latency_chart' %}
22 | {% endblock %}
23 |
24 | {% block additional_script %}
25 |
40 | {% endblock %}
41 |
42 |
--------------------------------------------------------------------------------
/rqueue-core/src/main/resources/templates/rqueue/running.html:
--------------------------------------------------------------------------------
1 | {% extends 'base' %}
2 | {% block main %}
3 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | {% for h in header %}
25 |
{{h}}
26 | {% endfor %}
27 |
28 |
29 |
30 | {% for task in tasks %}
31 |
32 | {% for td in task %}
33 |
{{td}}
34 | {% endfor %}
35 |
36 | {% endfor %}
37 |
38 |
39 |
40 |
41 | {% endblock %}
--------------------------------------------------------------------------------
/rqueue-core/src/test/java/com/github/sonus21/rqueue/CoreUnitTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue;
18 |
19 | import com.github.sonus21.junit.TestTracerExtension;
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 | import org.junit.jupiter.api.Tag;
25 | import org.junit.jupiter.api.extension.ExtendWith;
26 | import org.mockito.junit.jupiter.MockitoExtension;
27 |
28 |
29 | @Target({ElementType.TYPE})
30 | @Retention(RetentionPolicy.RUNTIME)
31 | @Tag("unit")
32 | @Tag("core")
33 | @ExtendWith({MockitoExtension.class, TestTracerExtension.class})
34 | public @interface CoreUnitTest {
35 |
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/rqueue-core/src/test/java/com/github/sonus21/rqueue/listener/RqueueMessagePollerTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.listener;
18 |
19 | import com.github.sonus21.TestBase;
20 | import com.github.sonus21.rqueue.CoreUnitTest;
21 | import org.junit.jupiter.api.BeforeEach;
22 |
23 | @CoreUnitTest
24 | class RqueueMessagePollerTest extends TestBase {
25 | // DefaultRqueuePoller poller = new DefaultRqueuePoller();
26 |
27 | @BeforeEach
28 | void setUp() {
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/rqueue-core/src/test/java/com/github/sonus21/rqueue/utils/HttpUtilsTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.utils;
18 |
19 | import static org.junit.jupiter.api.Assertions.assertEquals;
20 |
21 | import com.github.sonus21.TestBase;
22 | import com.github.sonus21.rqueue.CoreUnitTest;
23 | import org.junit.jupiter.api.Test;
24 |
25 | @CoreUnitTest
26 | class HttpUtilsTest extends TestBase {
27 |
28 | @Test
29 | void joinPath() {
30 | assertEquals("/", HttpUtils.joinPath(null, null));
31 | assertEquals("/", HttpUtils.joinPath(null, "/"));
32 | assertEquals("/foo/", HttpUtils.joinPath(null, "/foo"));
33 | assertEquals("/foo/bar/", HttpUtils.joinPath(null, "/foo/", "/bar"));
34 | assertEquals("/foo/bar/", HttpUtils.joinPath("/foo/", null, "/bar"));
35 | assertEquals("/foo/bar/", HttpUtils.joinPath("/foo/", "/", "/bar"));
36 | assertEquals("/foo/bar/", HttpUtils.joinPath("foo", "/", "bar"));
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/rqueue-core/src/test/java/com/github/sonus21/rqueue/utils/RqueueMessageTestUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.utils;
18 |
19 | import com.github.sonus21.rqueue.core.DefaultRqueueMessageConverter;
20 | import com.github.sonus21.rqueue.core.RqueueMessage;
21 | import com.github.sonus21.rqueue.core.support.RqueueMessageUtils;
22 | import lombok.AccessLevel;
23 | import lombok.NoArgsConstructor;
24 | import org.springframework.messaging.converter.MessageConverter;
25 |
26 | @NoArgsConstructor(access = AccessLevel.PRIVATE)
27 | public class RqueueMessageTestUtils {
28 |
29 | public static RqueueMessage createMessage(String queueName) {
30 | return createMessage(new DefaultRqueueMessageConverter(), queueName);
31 | }
32 |
33 |
34 | public static RqueueMessage createMessage(MessageConverter messageConverter, String queue) {
35 | return RqueueMessageUtils.generateMessage(messageConverter, queue);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/rqueue-spring-boot-example/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM tomcat:8.0.51-jre8-alpine
2 | RUN rm -rf /usr/local/tomcat/webapps/*
3 | ARG WAR_FILE=build/libs/*.war
4 | COPY ${WAR_FILE} /usr/local/tomcat/webapps/ROOT.war
5 | CMD ["catalina.sh","run"]
--------------------------------------------------------------------------------
/rqueue-spring-boot-example/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id "org.springframework.boot" version "${springBootVersion}"
3 | id "io.spring.dependency-management" version "${springDepManagementVersion}"
4 | id "war"
5 | }
6 | dependencies {
7 | implementation project(":rqueue-spring-boot-starter")
8 | implementation "org.springframework.boot:spring-boot-starter-data-redis"
9 | implementation "org.springframework.boot:spring-boot-starter-web"
10 | // https://mvnrepository.com/artifact/ch.qos.logback/logback-core
11 | implementation "ch.qos.logback:logback-core:${logbackVersion}"
12 | // https://mvnrepository.com/artifact/ch.qos.logback/logback-classic
13 | implementation "ch.qos.logback:logback-classic:${logbackVersion}"
14 | implementation "io.lettuce:lettuce-core"
15 | annotationProcessor "org.springframework.boot:spring-boot-configuration-processor"
16 | providedRuntime "org.springframework.boot:spring-boot-starter-tomcat"
17 | }
18 |
--------------------------------------------------------------------------------
/rqueue-spring-boot-example/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | prometheus:
4 | ports:
5 | - "9090:9090"
6 | volumes:
7 | - ./prometheus.yml:/etc/prometheus/prometheus.yml
8 | image: prom/prometheus
9 |
10 | grafana:
11 | ports:
12 | - "3000:3000"
13 | image: grafana/grafana
14 |
15 | redis:
16 | ports:
17 | - "6379:6379"
18 | image: redis
19 | rqueue:
20 | container_name: rqueue
21 | build:
22 | dockerfile: Dockerfile
23 | context: .
24 | environment:
25 | - spring.data.redis.host=redis
26 | ports:
27 | - "8080:8080"
28 | image: rqueue
29 | depends_on:
30 | - redis
31 | - prometheus
32 | - grafana
33 |
34 |
--------------------------------------------------------------------------------
/rqueue-spring-boot-example/prometheus.yml:
--------------------------------------------------------------------------------
1 | global:
2 | scrape_interval: 15s
3 |
4 | scrape_configs:
5 | - job_name: 'prometheus'
6 | scrape_interval: 10s
7 | scrape_timeout: 5s
8 | metrics_path: '/actuator/prometheus'
9 | static_configs:
10 | - targets: [ 'rqueue:8080' ]
11 |
--------------------------------------------------------------------------------
/rqueue-spring-boot-example/src/main/java/com/github/sonus21/rqueue/example/Job.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.example;
18 |
19 | import lombok.Getter;
20 | import lombok.Setter;
21 | import lombok.ToString;
22 |
23 | @Getter
24 | @Setter
25 | @ToString
26 | public class Job {
27 |
28 | private String id;
29 | private String message;
30 | private String messageId;
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/rqueue-spring-boot-example/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (c) 2019-2023 Sonu Kumar
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # You may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # https://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and limitations under the License.
14 | #
15 | #
16 | spring.data.redis.database=0
17 | spring.data.redis.host=localhost
18 | spring.data.redis.port=6379
19 | rqueue.simple.queue=simple-queue
20 | rqueue.delay.queue=delay-queue
21 | rqueue.delay.queue.scheduled-queue=true
22 | rqueue.delay.queue.retries=3
23 | rqueue.delay2.queue=delay-queue2
24 | job.fail.percentage=30
25 | job.execution.interval=2000
26 | # Enable prometheus exporter
27 | rqueue.metrics.tags.suite=JMeter
28 | rqueue.metrics.count.failure=true
29 | rqueue.metrics.count.execution=true
30 | management.prometheus.metrics.export.enabled=true
31 | management.endpoints.web.exposure.include=*
32 | management.endpoint.beans.enabled=true
33 | management.endpoint.health.enabled=true
34 | rqueue.scheduler.scheduled.message.time.interval=5000
35 | workers.count=100
36 | scale.enabled=true
37 |
--------------------------------------------------------------------------------
/rqueue-spring-boot-reactive-example/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id "org.springframework.boot" version "${springBootVersion}"
3 | id "io.spring.dependency-management" version "${springDepManagementVersion}"
4 | id "war"
5 | }
6 | dependencies {
7 | implementation project(":rqueue-spring-boot-starter")
8 | implementation "org.springframework.boot:spring-boot-starter-data-redis-reactive"
9 | implementation "org.springframework.boot:spring-boot-starter-webflux"
10 | implementation "io.lettuce:lettuce-core"
11 | // https://mvnrepository.com/artifact/ch.qos.logback/logback-core
12 | implementation "ch.qos.logback:logback-core:${logbackVersion}"
13 | // https://mvnrepository.com/artifact/ch.qos.logback/logback-classic
14 | implementation "ch.qos.logback:logback-classic:${logbackVersion}"
15 | }
16 |
--------------------------------------------------------------------------------
/rqueue-spring-boot-reactive-example/src/main/java/com/github/sonus21/task/executor/Job.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.task.executor;
18 |
19 | public class Job {
20 |
21 | private String id;
22 | private String message;
23 |
24 | public String getId() {
25 | return id;
26 | }
27 |
28 | public void setId(String id) {
29 | this.id = id;
30 | }
31 |
32 | public String getMessage() {
33 | return message;
34 | }
35 |
36 | public void setMessage(String message) {
37 | this.message = message;
38 | }
39 |
40 | @Override
41 | public String toString() {
42 | return "Job[id=" + id + " , message=" + message + "]";
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/rqueue-spring-boot-reactive-example/src/main/java/com/github/sonus21/task/executor/WebFluxConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.task.executor;
18 |
19 | import org.springframework.context.annotation.Configuration;
20 | import org.springframework.web.reactive.config.EnableWebFlux;
21 | import org.springframework.web.reactive.config.ResourceHandlerRegistry;
22 | import org.springframework.web.reactive.config.WebFluxConfigurer;
23 |
24 | @EnableWebFlux
25 | @Configuration
26 | public class WebFluxConfig implements WebFluxConfigurer {
27 |
28 | @Override
29 | public void addResourceHandlers(ResourceHandlerRegistry registry) {
30 | if (!registry.hasMappingForPattern("/**")) {
31 | registry.addResourceHandler("/**").addResourceLocations("classpath:/public/");
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/rqueue-spring-boot-reactive-example/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Copyright (c) 2021-2023 Sonu Kumar
3 | #
4 | # Licensed under the Apache License, Version 2.0 (the "License");
5 | # You may not use this file except in compliance with the License.
6 | # You may obtain a copy of the License at
7 | #
8 | # https://www.apache.org/licenses/LICENSE-2.0
9 | #
10 | # Unless required by applicable law or agreed to in writing, software
11 | # distributed under the License is distributed on an "AS IS" BASIS,
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | # See the License for the specific language governing permissions and limitations under the License.
14 | #
15 | #
16 | spring.data.redis.database=0
17 | spring.data.redis.host=localhost
18 | spring.data.redis.port=6379
19 | rqueue.simple.queue=simple-queue
20 | rqueue.delay.queue=delay-queue
21 | rqueue.delay.queue.scheduled-queue=true
22 | rqueue.delay.queue.retries=3
23 | rqueue.delay2.queue=delay-queue2
24 | delay.queue.fail.percentage=30
25 | # Enable prometheus exporter
26 | rqueue.metrics.tags.suite=JMeter
27 | rqueue.metrics.count.failure=true
28 | rqueue.metrics.count.execution=true
29 | management.prometheus.metrics.export.enabled=true
30 | management.endpoints.web.exposure.include=*
31 | management.endpoint.beans.enabled=true
32 | management.endpoint.health.enabled=true
33 | rqueue.scheduler.scheduled.message.time.interval=5000
34 | workers.count=5
35 | spring.main.web-application-type=reactive
36 | rqueue.reactive.enabled=true
--------------------------------------------------------------------------------
/rqueue-spring-boot-reactive-example/src/test/java/com/github/sonus21/task/executor/RqueueReactiveTaskExecutorApplicationTests.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.task.executor;
18 |
19 | import org.junit.jupiter.api.Test;
20 | import org.springframework.boot.test.context.SpringBootTest;
21 |
22 | @SpringBootTest
23 | class RqueueReactiveTaskExecutorApplicationTests {
24 |
25 | @Test
26 | void contextLoads() {
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/rqueue-spring-boot-starter/build.gradle:
--------------------------------------------------------------------------------
1 | ext.projectDescription = "Asynchronous and Scheduled task executor for spring boot framework"
2 | ext.name = "Rqueue Spring Boot Java"
3 | buildscript {
4 | apply from: "${rootDir}/gradle/code-signing.gradle"
5 | apply from: "${rootDir}/gradle/packaging.gradle"
6 | apply from: "${rootDir}/gradle/test-runner.gradle"
7 | }
8 |
9 | dependencies {
10 | api project(":rqueue-core")
11 | api "org.springframework.boot:spring-boot-starter-data-redis:${springBootVersion}"
12 | // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-actuator
13 | api "org.springframework.boot:spring-boot-starter-actuator:${springBootVersion}", optional
14 | testImplementation project(":rqueue-spring-common-test")
15 | testImplementation "org.springframework.boot:spring-boot-starter-test:${springBootVersion}"
16 | testImplementation "org.springframework.boot:spring-boot-starter-webflux:${springBootVersion}"
17 | testImplementation "org.springframework.boot:spring-boot-starter-data-redis-reactive:${springBootVersion}"
18 | testImplementation "org.springframework.boot:spring-boot-starter-data-jpa:${springBootVersion}"
19 | testImplementation "org.springframework.boot:spring-boot-devtools:${springBootVersion}"
20 | }
21 |
--------------------------------------------------------------------------------
/rqueue-spring-boot-starter/src/main/java/com/github/sonus21/rqueue/spring/boot/RqueueMetricsProperties.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.spring.boot;
18 |
19 | import com.github.sonus21.rqueue.config.MetricsProperties;
20 | import org.springframework.boot.context.properties.ConfigurationProperties;
21 | import org.springframework.context.annotation.Configuration;
22 |
23 | @Configuration
24 | @ConfigurationProperties(prefix = "rqueue.metrics")
25 | public class RqueueMetricsProperties extends MetricsProperties {
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/rqueue-spring-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports:
--------------------------------------------------------------------------------
1 | com.github.sonus21.rqueue.spring.boot.RqueueListenerAutoConfig
2 | com.github.sonus21.rqueue.spring.boot.RqueueMetricsAutoConfig
--------------------------------------------------------------------------------
/rqueue-spring-boot-starter/src/test/java/com/github/sonus21/rqueue/spring/boot/application/Application.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.spring.boot.application;
18 |
19 | import com.github.sonus21.rqueue.test.application.BaseApplication;
20 | import org.springframework.boot.SpringApplication;
21 | import org.springframework.boot.autoconfigure.SpringBootApplication;
22 | import org.springframework.context.annotation.PropertySource;
23 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
24 | import org.springframework.transaction.annotation.EnableTransactionManagement;
25 |
26 | @PropertySource("classpath:application.properties")
27 | @SpringBootApplication(scanBasePackages = {"com.github.sonus21.rqueue.test"})
28 | @EnableJpaRepositories(basePackages = {"com.github.sonus21.rqueue.test.repository"})
29 | @EnableTransactionManagement
30 | public class Application extends BaseApplication {
31 |
32 | public static void main(String[] args) {
33 | SpringApplication.run(Application.class, args);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/rqueue-spring-boot-starter/src/test/java/com/github/sonus21/rqueue/spring/boot/reactive/WebFluxConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.spring.boot.reactive;
18 |
19 | import org.springframework.context.annotation.Configuration;
20 | import org.springframework.web.reactive.config.EnableWebFlux;
21 | import org.springframework.web.reactive.config.ResourceHandlerRegistry;
22 | import org.springframework.web.reactive.config.WebFluxConfigurer;
23 |
24 | @EnableWebFlux
25 | @Configuration
26 | public class WebFluxConfig implements WebFluxConfigurer {
27 |
28 | @Override
29 | public void addResourceHandlers(ResourceHandlerRegistry registry) {
30 | if (!registry.hasMappingForPattern("/**")) {
31 | registry.addResourceHandler("/**").addResourceLocations("classpath:/public/");
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/rqueue-spring-boot-starter/src/test/java/com/github/sonus21/rqueue/spring/boot/tests/SpringBootIntegrationTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.spring.boot.tests;
18 |
19 | import com.github.sonus21.junit.TestTracerExtension;
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 | import org.junit.jupiter.api.Tag;
25 | import org.junit.jupiter.api.extension.ExtendWith;
26 |
27 | @Target({ElementType.TYPE})
28 | @Retention(RetentionPolicy.RUNTIME)
29 | @Tag("springBootIntegration")
30 | @Tag("integration")
31 | @Tag("springBoot")
32 | @ExtendWith({TestTracerExtension.class})
33 | public @interface SpringBootIntegrationTest {
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/rqueue-spring-boot-starter/src/test/java/com/github/sonus21/rqueue/spring/boot/tests/SpringBootUnitTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.spring.boot.tests;
18 |
19 | import com.github.sonus21.junit.TestTracerExtension;
20 | import java.lang.annotation.ElementType;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 | import org.junit.jupiter.api.Tag;
25 | import org.junit.jupiter.api.extension.ExtendWith;
26 | import org.mockito.junit.jupiter.MockitoExtension;
27 |
28 | @Target({ElementType.TYPE})
29 | @Retention(RetentionPolicy.RUNTIME)
30 | @Tag("springBoot")
31 | @Tag("unit")
32 | @Tag("springBootUnit")
33 | @ExtendWith({MockitoExtension.class, TestTracerExtension.class})
34 | public @interface SpringBootUnitTest {
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/rqueue-spring-common-test/build.gradle:
--------------------------------------------------------------------------------
1 | dependencies {
2 | implementation project(":rqueue-core")
3 | api project(":rqueue-test-util")
4 | // https://mvnrepository.com/artifact/io.micrometer/micrometer-registry-prometheus
5 | api "io.micrometer:micrometer-registry-prometheus:${microMeterVersion}"
6 | api "io.projectreactor:reactor-test:${projectReactorReactorTestVersion}"
7 | }
8 |
--------------------------------------------------------------------------------
/rqueue-spring-common-test/src/main/java/com/github/sonus21/rqueue/test/DeleteMessageListener.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2019-2023 Sonu Kumar
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * You may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * https://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and limitations under the License.
14 | *
15 | */
16 |
17 | package com.github.sonus21.rqueue.test;
18 |
19 | import com.github.sonus21.rqueue.core.Job;
20 | import com.github.sonus21.rqueue.core.support.MessageProcessor;
21 | import java.util.ArrayList;
22 | import java.util.List;
23 |
24 | public class DeleteMessageListener implements MessageProcessor {
25 |
26 | private List