// Path: mq-aliyun-consumer-spring-boot-starter/src/main/java/com/github/mq/consumer/ConsumerAble.java
// public interface ConsumerAble {
//     String BROADCASTING = "BROADCASTING";
//     String CLUSTERING = "CLUSTERING";
// 
//     void init(Ons ons);
// }
// 
// Path: mq-aliyun-consumer-spring-boot-starter/src/main/java/com/github/mq/consumer/Ons.java
// public interface Ons {
//     void defaultTopic(String topic);
//     ConsumerBuild consumer(String cid);
//     ConsumerBuild consumer(String cid, ConsumerOptional consumerOptional);
// 
//     ConsumerBuild consumerOrdered(String cid);
//     ConsumerBuild consumerOrdered(String cid, ConsumerOptional consumerOptional);
// }
// 
// Path: mq-aliyun-consumer-spring-boot-starter/src/main/java/com/github/mq/consumer/models/ConsumerOptional.java
// public class ConsumerOptional {
//     //消费线程数
//     private Integer consumeThread;
//     //消费模式(集群 : CLUSTERING, 广播 : BROADCASTING)
//     private String consumerModel;
//     //消息消费失败时的最大重试次数
//     private Integer maxReconsume;
//     //顺序消息消费失败进行重试前的等待时间 单位(毫秒)
//     private Integer suspendTime;
// 
//     public ConsumerOptional(){}
// 
//     public ConsumerOptional(Integer consumeThread){
//         this.consumeThread = consumeThread;
//     }
// 
//     public ConsumerOptional(Integer consumeThread,Integer maxReconsume){
//         this.consumeThread = consumeThread;
//         this.maxReconsume = maxReconsume;
//     }
// 
//     public Integer getConsumeThread() {
//         return consumeThread;
//     }
// 
//     public ConsumerOptional setConsumeThread(Integer consumeThread) {
//         this.consumeThread = consumeThread;
//         return this;
//     }
// 
//     public String getConsumerModel() {
//         return consumerModel;
//     }
// 
//     public ConsumerOptional setConsumerModel(String consumerModel) {
//         this.consumerModel = consumerModel;
//         return this;
//     }
// 
//     public Integer getMaxReconsume() {
//         return maxReconsume;
//     }
// 
//     public ConsumerOptional setMaxReconsume(Integer maxReconsume) {
//         this.maxReconsume = maxReconsume;
//         return this;
//     }
// 
//     public Integer getSuspendTime() {
//         return suspendTime;
//     }
// 
//     public ConsumerOptional setSuspendTime(Integer suspendTime) {
//         this.suspendTime = suspendTime;
//         return this;
//     }
// }
// 
// Path: mq-aliyun-example/src/main/java/com/mq/aliyun/example/consumers/TestConsumer.java
// @Reconsume(5)
// public class TestConsumer {
//     @Reconsume(3)
//     public Action dishAdd(Dish dish){
//         //do some thine
//         return Action.commit;
//     }
// 
// 
//     public Action dishDel(Long dishId, Message message){
//         //Message 为阿里云mq 原生消息体
// 
//         //do some thing
//         return Action.commit;
//     }
// 
//     public Action jackjson(@JackJson Dish dish){
//         //do some thine
//         return Action.commit;
//     }
// }


import com.github.mq.consumer.ConsumerAble;
import com.github.mq.consumer.Ons;
import com.github.mq.consumer.models.ConsumerOptional;
import com.mq.aliyun.example.consumers.TestConsumer;
package com.mq.aliyun.example;


/**
 * Created by wangziqing on 17/7/25.
 */

public class Consumers implements ConsumerAble {
    @Override
    public void init(Ons ons) {
        //订阅普通消息(无序)
        ons.consumer("CID_MEICANYUN_ORDER")
                .subscribeTopic("MEICANYUN")
// Path: mq-aliyun-consumer-spring-boot-starter/src/main/java/com/github/mq/consumer/ConsumerAble.java
// public interface ConsumerAble {
//     String BROADCASTING = "BROADCASTING";
//     String CLUSTERING = "CLUSTERING";
// 
//     void init(Ons ons);
// }
// 
// Path: mq-aliyun-consumer-spring-boot-starter/src/main/java/com/github/mq/consumer/Ons.java
// public interface Ons {
//     void defaultTopic(String topic);
//     ConsumerBuild consumer(String cid);
//     ConsumerBuild consumer(String cid, ConsumerOptional consumerOptional);
// 
//     ConsumerBuild consumerOrdered(String cid);
//     ConsumerBuild consumerOrdered(String cid, ConsumerOptional consumerOptional);
// }
// 
// Path: mq-aliyun-consumer-spring-boot-starter/src/main/java/com/github/mq/consumer/models/ConsumerOptional.java
// public class ConsumerOptional {
//     //消费线程数
//     private Integer consumeThread;
//     //消费模式(集群 : CLUSTERING, 广播 : BROADCASTING)
//     private String consumerModel;
//     //消息消费失败时的最大重试次数
//     private Integer maxReconsume;
//     //顺序消息消费失败进行重试前的等待时间 单位(毫秒)
//     private Integer suspendTime;
// 
//     public ConsumerOptional(){}
// 
//     public ConsumerOptional(Integer consumeThread){
//         this.consumeThread = consumeThread;
//     }
// 
//     public ConsumerOptional(Integer consumeThread,Integer maxReconsume){
//         this.consumeThread = consumeThread;
//         this.maxReconsume = maxReconsume;
//     }
// 
//     public Integer getConsumeThread() {
//         return consumeThread;
//     }
// 
//     public ConsumerOptional setConsumeThread(Integer consumeThread) {
//         this.consumeThread = consumeThread;
//         return this;
//     }
// 
//     public String getConsumerModel() {
//         return consumerModel;
//     }
// 
//     public ConsumerOptional setConsumerModel(String consumerModel) {
//         this.consumerModel = consumerModel;
//         return this;
//     }
// 
//     public Integer getMaxReconsume() {
//         return maxReconsume;
//     }
// 
//     public ConsumerOptional setMaxReconsume(Integer maxReconsume) {
//         this.maxReconsume = maxReconsume;
//         return this;
//     }
// 
//     public Integer getSuspendTime() {
//         return suspendTime;
//     }
// 
//     public ConsumerOptional setSuspendTime(Integer suspendTime) {
//         this.suspendTime = suspendTime;
//         return this;
//     }
// }
// 
// Path: mq-aliyun-example/src/main/java/com/mq/aliyun/example/consumers/TestConsumer.java
// @Reconsume(5)
// public class TestConsumer {
//     @Reconsume(3)
//     public Action dishAdd(Dish dish){
//         //do some thine
//         return Action.commit;
//     }
// 
// 
//     public Action dishDel(Long dishId, Message message){
//         //Message 为阿里云mq 原生消息体
// 
//         //do some thing
//         return Action.commit;
//     }
// 
//     public Action jackjson(@JackJson Dish dish){
//         //do some thine
//         return Action.commit;
//     }
// }


// Path: mq-aliyun-example/src/main/java/com/mq/aliyun/example/Consumers.java
import com.github.mq.consumer.ConsumerAble;
import com.github.mq.consumer.Ons;
import com.github.mq.consumer.models.ConsumerOptional;
import com.mq.aliyun.example.consumers.TestConsumer;

package com.mq.aliyun.example;


/**
 * Created by wangziqing on 17/7/25.
 */

public class Consumers implements ConsumerAble {
    @Override
    public void init(Ons ons) {
        //订阅普通消息(无序)
        ons.consumer("CID_MEICANYUN_ORDER")
                .subscribeTopic("MEICANYUN")
                .subscribeTag("dish.add || dish.update",TestConsumer::dishAdd)