我们的项目就基于这个模型:
接下来就到了我们的实战时刻~
项目基于spring cloud编写,没有spring cloud基础看起来可能有一点点费力。
准备阶段:定义可靠消息接口
package com.anur.messageapi.api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Map;
/**
* Created by Anur IjuoKaruKas on 2018/5/8
*/
public interface TransactionMsgApi {
/**
* 预发送消息,先将消息保存到消息中心
*/
@RequestMapping(value = "prepare", method = RequestMethod.GET)
int prepareMsg(
@RequestParam("id") String id,
@RequestParam("msg") String msg,
@RequestParam("routingKey") String routingKey,
@RequestParam("exchange") String exchange,
@RequestParam("paramMap") String paramMap,