1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package com.yanzuoguang.mq.service;
import com.rabbitmq.client.Channel;
import com.yanzuoguang.mq.vo.MessageVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.ChannelAwareMessageListener;
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
/**
* 发送消息服务
*
* @author 颜佐光
*/
public interface MessageSendService {
/**
* 打上批次,并且所有消息延迟一定时间处理,增加处理次数1次
*
* @param batchId 批次编号
* @param size 消费条数
* @return 批次数据
*/
boolean resendFair(String batchId, int size);
/**
* 发送消息
*
* @param req 发送消息
* @return 发送结果
*/
String send(MessageVo req);
/**
* 消息发送成功
*
* @param id 编号
* @return 成功后返回编号
*/
String onSuccess(String id);
/**
* 消息发送失败
*
* @param messageVo 消息处理错误
* @return 成功后返回编号
*/
String onError(MessageVo messageVo);
/**
* 消息收到确认
*
* @param message 收到的消息
* @param channel 收到的通道
*/
@ApiOperation(value = "消息收到确认")
void basicAck(Message message, Channel channel);
/**
* 动态初始化消息队列处理
*
* @param queueName 队列名字
* @param messageListener 消息处理函数
* @return
*/
@ApiOperation(value = "动态初始化消息队列处理")
SimpleMessageListenerContainer init(String queueName, ChannelAwareMessageListener messageListener);
/**
* 动态初始化消息队列处理
*
* @param queueName 队列名字
* @param concurrency 线程数量
* @param messageListener 消息处理函数
* @return
*/
@ApiOperation(value = "动态初始化消息队列处理")
SimpleMessageListenerContainer init(String queueName, int concurrency, ChannelAwareMessageListener messageListener);
/**
* 动态初始化消息队列处理
*
* @param queueName 队列名字
* @param concurrency 线程数量
* @param maxConcurrency 最大线程数量个
* @param messageListener 消息处理函数
* @return
*/
@ApiOperation(value = "动态初始化消息队列处理")
SimpleMessageListenerContainer init(String queueName, int concurrency, int maxConcurrency, ChannelAwareMessageListener messageListener);
}