- hsweb-message-api API
- hsweb-message-jms JMS实现
- hsweb-message-memory 内存实现
- hsweb-message-redis Redis实现(redisson)
- hsweb-message-websocket 使用websocket进行消息推送
import org.hswebframework.web.message.Messager;
import static org.hswebframework.web.message.builder.StaticMessageBuilder.object;
import static org.hswebframework.web.message.builder.StaticMessageSubjectBuilder.queue;
import static org.hswebframework.web.message.builder.StaticMessageSubjectBuilder.topic;
@Autowired
private Messager messager;
public void sendToQueue(){
messager.publish(text("hello queue!"))
.to(queue("test_queue"))
.send();
}
public void subscribeQueue(){
messager.<TextMessage>subscribe(queue("test_queue"))
.onMessage(textMsg->System.out.println(textMsg.getMessage()));
public void sendToTopic(){
messager.publish(text("hello topic!"))
.to(queue("test_topic"))
.send();
}
public void subscribeTopic(){
messager.<TextMessage>subscribe(queue("test_topic"))
.onMessage(textMsg->System.out.println(textMsg.getMessage()));
}