https://github.com/pig-mesh/beanstalkd-spring-boot-starter
Beanstalkd分布式内存队列系统 的 spring boot starter 封装
https://github.com/pig-mesh/beanstalkd-spring-boot-starter
beanstalkd spring-boot
Last synced: 6 months ago
JSON representation
Beanstalkd分布式内存队列系统 的 spring boot starter 封装
- Host: GitHub
- URL: https://github.com/pig-mesh/beanstalkd-spring-boot-starter
- Owner: pig-mesh
- Created: 2020-02-07T08:57:58.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-05-10T12:55:40.000Z (over 3 years ago)
- Last Synced: 2025-04-10T18:07:04.074Z (6 months ago)
- Topics: beanstalkd, spring-boot
- Language: Java
- Homepage: https://beanstalkd.github.io/
- Size: 82 KB
- Stars: 2
- Watchers: 2
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## ① 部署 beanstalkd 服务
```shell
docker run -d -p 11300:11300 schickling/beanstalkd
```## ② 引入依赖
```shell
com.pig4cloud.beanstalk
beanstalkd-client-spring-boot-starter
0.0.2```
## ③ 代码调用
- 配置文件
-
```properties
spring.beanstalkd.host=127.0.0.1
spring.beanstalkd.port=11300
```- 消费方
```java
@Slf4j
@Configuration(proxyBeanMethods = false)
public class WorkConfig extends AbstractTubeConsumerListener {
@Override
public void work(JobConsumer consumer) {
Job job = consumer.reserveJob(10);
consumer.deleteJob(job.getId());
log.info("任务内容{}", new String(job.getData()));
}
}
```- 提供方
```java
@Autowired
private JobProducer producer;@Test
void contextLoads() {
long jobId = producer.putJob(1, 10, 5, "hello job".getBytes(StandardCharsets.UTF_8));
}
```