GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - KubrickLiu/presistent-queue: Persistent message queue. Messages are stored in the disk. Messages by cursor are supported

BranchesTags
Open more actions menu

Latest commit

 

History

3 Commits
3 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

Repository files navigation

Apache License, Version 2.0, January 2004 Maven Central

presistent-queue

Persistent message queue. Messages are stored in the disk. Messages by cursor are supported

What this is

persistent-message-queue is a queue SDK that stores messages on disk.

Function point

  • Messages are stored in the disk to ensure that the service will not stackoverflow in memory due to too many messages;
    • 消息存储在磁盘中,可以保证服务不会因消息过多导致内存溢出;
  • Messages are not one-time consumption. Messages can be subscribed again by cursor;
    • 消息不是一次性消费,消息可以按 cursor 再次订阅;
  • Service restart will not lose messages;
    • 服务重新启动不会丢失消息;
  • After the service is restarted, it can automatically continue to execute from the last address written or read;
    • 服务重新启动后可以自动从上次写入或读取的地址继续执行;
  • Thanks to Kafka logsegment;
    • 致谢 Kafka LogSegment;

Quick-start

Maven:

<dependency>
    <groupId>io.github.kubrickLiu</groupId>
    <artifactId>persistent-queue</artifactId>
    <version>1.0.1</version>
</dependency>

Example Code :

1. Single file queue ;

produce message:

File file = new File("${file path}");

// create a single file persistent file -- FileRecords
FileRecords fileRecords = new FileRecords(file);

// mock id and message
int id = idGenerator.getAndIncrement();
String message = "msg-" + id;

// build a Record 
Record record = new Record(id, message.getBytes());

// append message to persistent queue
fileRecords.appendOne(record);

consume message:

// get iterator from FileRecords
Iterator<Record> iterator = fileRecords.iterator();

// consume record from persistent queue
while (iterator.hasNext()) {
    Record result = iterator.next();
    System.out.println(result.getId() + " : " + new String(result.getBytes()));
}

About

Persistent message queue. Messages are stored in the disk. Messages by cursor are supported

Resources

Readme
Apache-2.0 license
Activity

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.