All Projects → sonus21 → Rqueue

sonus21 / Rqueue

Licence: apache-2.0
Rqueue aka Redis Queue [Task Queue, Message Broker] for Spring framework

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Rqueue

Spring Boot Demo
spring boot demo 是一个Spring Boot、Spring Cloud的项目示例,根据市场主流的后端技术,共集成了30+个demo,未来将持续更新。该项目包含helloworld(快速入门)、web(ssh项目快速搭建)、aop(切面编程)、data-redis(redis缓存)、quartz(集群任务实现)、shiro(权限管理)、oauth2(四种认证模式)、shign(接口参数防篡改重放)、encoder(用户密码设计)、actuator(服务监控)、cloud-config(配置中心)、cloud-gateway(服务网关)等模块
Stars: ✭ 323 (+325%)
Mutual labels:  redis, spring-boot, spring
Spring Boot Klock Starter
基于redis的分布式锁组件,简单方便快捷接入项目,使项目拥有分布式锁能力
Stars: ✭ 546 (+618.42%)
Mutual labels:  redis, spring-boot, spring
Ibase4j Springboot
Spring,SpringBoot,SpringMVC,Mybatis,mybatis-plus,motan/dubbo分布式,Redis缓存,Shiro权限管理,Spring-Session单点登录,Quartz分布式集群调度,Restful服务,QQ/微信登录,App token登录,微信/支付宝支付;日期转换、数据类型转换、序列化、汉字转拼音、身份证号码验证、数字转人民币、发送短信、发送邮件、加密解密、图片处理、excel导入导出、FTP/SFTP/fastDFS上传下载、二维码、XML读写、高精度计算、系统配置工具类等等。
Stars: ✭ 348 (+357.89%)
Mutual labels:  redis, spring-boot, spring
Spring Boot Demo
Spring Boot & Spring Cloud & Spring Security Demo Case(Spring学习示例实战项目)
Stars: ✭ 255 (+235.53%)
Mutual labels:  redis, spring-boot, spring
Web Development Interview With Java
Java 开发相关技术栈(大中厂)高频面试问题收录。
Stars: ✭ 69 (-9.21%)
Mutual labels:  redis, spring-boot, spring
Org.openwms
Open Warehouse Management System
Stars: ✭ 258 (+239.47%)
Mutual labels:  spring-boot, spring, spring-framework
Eshop Soa
EShop基于Dubbo实现SOA服务化拆分,并基于RocketMQ解决了分布式事务(新版SpringBootSOASkeleton)
Stars: ✭ 65 (-14.47%)
Mutual labels:  redis, spring-boot, spring
Study
全栈工程师学习笔记;Spring登录、shiro登录、CAS单点登录和Spring boot oauth2单点登录;Spring data cache 缓存,支持Redis和EHcahce; web安全,常见web安全漏洞以及解决思路;常规组件,比如redis、mq等;quartz定时任务,支持持久化数据库,动态维护启动暂停关闭;docker基本用法,常用image镜像使用,Docker-MySQL、docker-Postgres、Docker-nginx、Docker-nexus、Docker-Redis、Docker-RabbitMQ、Docker-zookeeper、Docker-es、Docker-zipkin、Docker-ELK等;mybatis实践、spring实践、spring boot实践等常用集成;基于redis的分布式锁;基于shared-jdbc的分库分表,支持原生jdbc和Spring Boot Mybatis
Stars: ✭ 159 (+109.21%)
Mutual labels:  redis, spring-boot, spring
Javaquarkbbs
基于Spring Boot实现的一个简易的Java社区
Stars: ✭ 755 (+893.42%)
Mutual labels:  redis, spring-boot, spring
Mica
Spring Cloud 微服务开发核心工具集。工具类、验证码、http、redis、ip2region、xss 等,开箱即用。 🔝 🔝 记得右上角点个star 关注更新!
Stars: ✭ 749 (+885.53%)
Mutual labels:  redis, spring-boot, spring
TaskManager
A C++14 Task Manager / Scheduler
Stars: ✭ 81 (+6.58%)
Mutual labels:  workers, task-manager, task-scheduler
Spring Boot
spring-boot 项目实践总结
Stars: ✭ 989 (+1201.32%)
Mutual labels:  redis, spring-boot, spring
Dramatiq
A fast and reliable background task processing library for Python 3.
Stars: ✭ 2,844 (+3642.11%)
Mutual labels:  task-manager, task-scheduler, redis
Celery
Distributed Task Queue (development branch)
Stars: ✭ 18,378 (+24081.58%)
Mutual labels:  task-manager, task-scheduler, redis
Dramatiq dashboard
A dashboard for dramatiq, specific to its Redis broker.
Stars: ✭ 82 (+7.89%)
Mutual labels:  task-manager, task-scheduler, redis
Cerberus
A demonstration of a completely stateless and RESTful token-based authorization system using JSON Web Tokens (JWT) and Spring Security.
Stars: ✭ 482 (+534.21%)
Mutual labels:  spring-boot, spring, spring-framework
Milkomeda
Spring extend componets which build from experience of bussiness, let developers to develop with Spring Boot as fast as possible.(基于Spring生态打造的一系列来自业务上的快速开发模块集合。)
Stars: ✭ 117 (+53.95%)
Mutual labels:  redis, spring-boot, spring
Ibase4j
Spring,SpringBoot 2.0,SpringMVC,Mybatis,mybatis-plus,motan/dubbo分布式,Redis缓存,Shiro权限管理,Spring-Session单点登录,Quartz分布式集群调度,Restful服务,QQ/微信登录,App token登录,微信/支付宝支付;日期转换、数据类型转换、序列化、汉字转拼音、身份证号码验证、数字转人民币、发送短信、发送邮件、加密解密、图片处理、excel导入导出、FTP/SFTP/fastDFS上传下载、二维码、XML读写、高精度计算、系统配置工具类等等。
Stars: ✭ 1,548 (+1936.84%)
Mutual labels:  redis, spring-boot, spring
Febs Shiro
Spring Boot 2.4.2,Shiro1.6.0 & Layui 2.5.6 权限管理系统。预览地址:http://47.104.70.138:8080/login
Stars: ✭ 5,655 (+7340.79%)
Mutual labels:  redis, spring-boot, spring
Springbootunity
rabbitmq、redis、scheduled、socket、mongodb、Swagger2、spring data jpa、Thymeleaf、freemarker etc. (muti module spring boot project) (with spring boot framework,different bussiness scence with different technology。)
Stars: ✭ 845 (+1011.84%)
Mutual labels:  redis, spring-boot, spring
Rqueue Logo

Rqueue: Redis Queue,Task Queue, Delayed Queue for Spring and Spring Boot

Build Status Coverage Status Maven Central Javadoc License

Rqueue is an asynchronous task executor(worker) built for spring framework based on the spring framework's messaging library backed by Redis. It can be used as message broker as well, where all services code is in Spring.


Message Flow

Features

  • Message Scheduling : A message can be scheduled for any arbitrary period
  • Competing Consumers multiple messages can be consumed in parallel by different workers.
  • Message delivery: It's guaranteed that a message is consumed at least once. (Message would be consumed by a worker more than once due to the failure in the underlying worker/restart-process etc, otherwise exactly one delivery)
  • Redis cluster : Redis cluster can be used with driver.
  • Metrics : In flight messages, waiting for consumption and delayed messages
  • Web Dashboard: a web dashboard to manage a queue and queue insights including latency
  • Automatic message serialization and deserialization
  • Concurrency: Concurrency of any queue can be configured
  • Queue Priority :
    • Group level queue priority(weighted and strict)
    • Sub queue priority(weighted and strict)
  • Execution Backoff : Exponential and fixed back off (default fixed back off)
  • Callbacks : Callbacks for dead letter queue, discard etc
  • Events 1. Bootstrap event 2. Task execution event.
  • Unique message : Unique message processing for a queue based on the message id
  • Periodic message : Process same message at certain interval
  • Redis connection: A different redis setup can be used for Rqueue
  • Long execution job: Long running jobs can check in periodically.
  • Middleware: Add one or more middleware, middlewares are called before listener method.
  • Message Multicasting: Call multiple message listeners on very message

Getting Started

Dependency

Spring-boot

  • Get the latest one from Maven central
  • Add dependency
    • Gradle
          implementation 'com.github.sonus21:rqueue-spring-boot-starter:2.6.1-RELEASE'
      
    • Maven
       <dependency>
          <groupId>com.github.sonus21</groupId>
          <artifactId>rqueue-spring-boot-starter</artifactId>
          <version>2.6.1-RELEASE</version>
      </dependency>
      

Spring framework

  • Get the latest one from Maven central
  • Add Dependency
    • Gradle
          implementation 'com.github.sonus21:rqueue-spring:2.6.1-RELEASE'
      
    • Maven
       <dependency>
         <groupId>com.github.sonus21</groupId>
         <artifactId>rqueue-spring</artifactId>
         <version>2.6.1-RELEASE</version>
       </dependency>
      
  1. Add annotation EnableRqueue on application config class
  2. Provide a RedisConnectionFactory bean

A Simple Spring Configuration

@EnableRqueue
public class Application {

  @Bean
  public RedisConnectionFactory redisConnectionFactory() {
    // return a redis connection factory
  }
}

Message publishing/Task submission

All messages need to be sent using RqueueMessageEnqueuer bean's enqueueXXX, enqueueInXXX and enqueueAtXXX methods. It has handful number of enqueue, enqueueIn, enqueueAt methods, we can use one of them based on the use case.

public class MessageService {

  @AutoWired
  private RqueueMessageEnqueuer rqueueMessageEnqueuer;

  public void doSomething() {
    rqueueMessageEnqueuer.enqueue("simple-queue", "Rqueue is configured");
  }

  public void createJOB(Job job) {
    rqueueMessageEnqueuer.enqueue("job-queue", job);
  }

  // send notification in 30 seconds
  public void sendNotification(Notification notification) {
    rqueueMessageEnqueuer.enqueueIn("notification-queue", notification, 30 * 1000L);
  }

  // enqueue At example
  public void createInvoice(Invoice invoice, Instant instant) {
    rqueueMessageEnqueuer.enqueueAt("invoice-queue", invoice, instant);
  }

  // enqueue with priority, when sub queues are used as explained in the queue priority section.
  enum SmsPriority {
    CRITICAL("critical"),
    HIGH("high"),
    MEDIUM("medium"),
    LOW("low");
    private String value;
  }

  public void sendSms(Sms sms, SmsPriority priority) {
    rqueueMessageEnqueuer.enqueueWithPriority("sms-queue", priority.value(), sms);
  }

  // enqueue periodic job, email should be sent every 30 seconds
  public void sendPeriodicEmail(Email email) {
    rqueueMessageEnqueuer.enqueuePeriodic("email-queue", invoice, 30_000);
  }

}

Worker/Consumer/Task executor/Listener

Any method that's part of spring bean, can be marked as worker/message listener using RqueueListener annotation

@Component
@Slf4j
public class MessageListener {

  @RqueueListener(value = "simple-queue")
  public void simpleMessage(String message) {
    log.info("simple-queue: {}", message);
  }

  @RqueueListener(value = "job-queue", numRetries = "3",
      deadLetterQueue = "failed-job-queue", concurrency = "5-10")
  public void onMessage(Job job) {
    log.info("Job alert: {}", job);
  }

  @RqueueListener(value = "push-notification-queue", numRetries = "3",
      deadLetterQueue = "failed-notification-queue")
  public void onMessage(Notification notification) {
    log.info("Push notification: {}", notification);
  }

  @RqueueListener(value = "sms", priority = "critical=10,high=8,medium=4,low=1")
  public void onMessage(Sms sms) {
    log.info("Sms : {}", sms);
  }

  @RqueueListener(value = "chat-indexing", priority = "20", priorityGroup = "chat")
  public void onMessage(ChatIndexing chatIndexing) {
    log.info("ChatIndexing message: {}", chatIndexing);
  }

  @RqueueListener(value = "chat-indexing-daily", priority = "10", priorityGroup = "chat")
  public void onMessage(ChatIndexing chatIndexing) {
    log.info("ChatIndexing message: {}", chatIndexing);
  }

  // checkin job example
  @RqueueListener(value = "chat-indexing-weekly", priority = "5", priorityGroup = "chat")
  public void onMessage(ChatIndexing chatIndexing,
      @Header(RqueueMessageHeaders.JOB) com.github.sonus21.rqueue.core.Job job) {
    log.info("ChatIndexing message: {}", chatIndexing);
    job.checkIn("Chat indexing...");
  }
}

Queue Statistics

Grafana Dashboard

Dashboard

Link: http://localhost:8080/rqueue

Execution Page

Explore Queue


[![Jobs](https://raw.githubusercontent.com/sonus21/rqueue/master/docs/static/jobs.png)](https://raw.githubusercontent.com/sonus21/rqueue/master/docs/static/jobs.png)

Status

Rqueue is stable and production ready, it's processing thousands of messages daily in production deployments.

We would love to add your organization name here, if you're one of the Rqueue users, please raise a PR/issue .

     

Support

  • Please report bug,question,feature(s) to issue tracker.
  • Ask question on StackOverflow using rqueue tag

Contribution

You are most welcome for any pull requests for any feature/bug/enhancement. You would need Java8 and gradle to start with. Please format your code with Google Java formatter.

Links

License

© Sonu Kumar 2019-Instant.now

The Rqueue is released under version 2.0 of the Apache License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].