// Path: mq-aliyun-producer-spring-boot-starter/src/main/java/com/github/mq/producer/ProducerFactory.java
// public interface ProducerFactory {
//     void sendAsync(final Enum address,final Object message);
//     void sendAsync(final Enum address,final Object message, final DeliveryOption deliveryOption);
//     void sendAsync(final Enum address,final Object message, final SendCallback sendCallback);
//     void sendAsync(final Enum address, final Object message, final DeliveryOption deliveryOption, final SendCallback sendCallback);
// 
//     SendResult orderSend(final Enum address, final Object message, final String shardingKey);
//     SendResult orderSend(final Enum address, final Object message, final String shardingKey,final DeliveryOption deliveryOption);
// 
//     Producer getProducer(String pid);
//     OrderProducer getOrderProducer(String pid);
//     void addProducer(String pid);
//     void addOrdereProducer(String pid);
// }
// 
// Path: mq-aliyun-example/src/main/java/com/mq/aliyun/example/model/Dish.java
// public class Dish {
//     private Long id;
//     private String name;
//     public Dish(){}
// 
//     public Dish(Long id,String name){
//         this.id = id;
//         this.name = name;
//     }
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public void setId(Long id) {
//         this.id = id;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
// }
// 
// Path: mq-aliyun-example/src/main/java/com/mq/aliyun/example/producers/OrderProducer.java
// @Pid(value = "PID_MEICANYUN" , ordered = true)
// public enum  OrderProducer {
//     @To(topic = "MEICANYUN_SHARDING",tag = "send.mail")
//     SEND_MAIL;
// }
// 
// Path: mq-aliyun-example/src/main/java/com/mq/aliyun/example/producers/TestProducer.java
// @Pid(value = "PID_MEICANYUN")
// public enum  TestProducer {
//     @To(topic = "MEICANYUN", tag = "dish.add")
//     DISH_ADD,
// 
//     @To(topic = "WEBSOCKET", tag = "dish.update")
//     DISH_UPDATE,
// 
//     @To(topic = "WEBSOCKET", tag = "dish.del")
//     DISH_DEL
// }


import com.aliyun.openservices.ons.api.SendResult;
import com.github.mq.producer.ProducerFactory;
import com.mq.aliyun.example.model.Dish;
import com.mq.aliyun.example.producers.OrderProducer;
import com.mq.aliyun.example.producers.TestProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
package com.mq.aliyun.example;


/**
 * Created by wangziqing on 17/7/25.
 */
@SpringBootApplication
public class Application implements CommandLineRunner {
    @Autowired
    private ProducerFactory producerFactory;


    public static void main(String[] args) {
        SpringApplication.run(Application.class);
    }

    @Override
    public void run(String... args) throws Exception {
// Path: mq-aliyun-producer-spring-boot-starter/src/main/java/com/github/mq/producer/ProducerFactory.java
// public interface ProducerFactory {
//     void sendAsync(final Enum address,final Object message);
//     void sendAsync(final Enum address,final Object message, final DeliveryOption deliveryOption);
//     void sendAsync(final Enum address,final Object message, final SendCallback sendCallback);
//     void sendAsync(final Enum address, final Object message, final DeliveryOption deliveryOption, final SendCallback sendCallback);
// 
//     SendResult orderSend(final Enum address, final Object message, final String shardingKey);
//     SendResult orderSend(final Enum address, final Object message, final String shardingKey,final DeliveryOption deliveryOption);
// 
//     Producer getProducer(String pid);
//     OrderProducer getOrderProducer(String pid);
//     void addProducer(String pid);
//     void addOrdereProducer(String pid);
// }
// 
// Path: mq-aliyun-example/src/main/java/com/mq/aliyun/example/model/Dish.java
// public class Dish {
//     private Long id;
//     private String name;
//     public Dish(){}
// 
//     public Dish(Long id,String name){
//         this.id = id;
//         this.name = name;
//     }
// 
//     public Long getId() {
//         return id;
//     }
// 
//     public void setId(Long id) {
//         this.id = id;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public void setName(String name) {
//         this.name = name;
//     }
// 
// }
// 
// Path: mq-aliyun-example/src/main/java/com/mq/aliyun/example/producers/OrderProducer.java
// @Pid(value = "PID_MEICANYUN" , ordered = true)
// public enum  OrderProducer {
//     @To(topic = "MEICANYUN_SHARDING",tag = "send.mail")
//     SEND_MAIL;
// }
// 
// Path: mq-aliyun-example/src/main/java/com/mq/aliyun/example/producers/TestProducer.java
// @Pid(value = "PID_MEICANYUN")
// public enum  TestProducer {
//     @To(topic = "MEICANYUN", tag = "dish.add")
//     DISH_ADD,
// 
//     @To(topic = "WEBSOCKET", tag = "dish.update")
//     DISH_UPDATE,
// 
//     @To(topic = "WEBSOCKET", tag = "dish.del")
//     DISH_DEL
// }


// Path: mq-aliyun-example/src/main/java/com/mq/aliyun/example/Application.java
import com.aliyun.openservices.ons.api.SendResult;
import com.github.mq.producer.ProducerFactory;
import com.mq.aliyun.example.model.Dish;
import com.mq.aliyun.example.producers.OrderProducer;
import com.mq.aliyun.example.producers.TestProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

package com.mq.aliyun.example;


/**
 * Created by wangziqing on 17/7/25.
 */
@SpringBootApplication
public class Application implements CommandLineRunner {
    @Autowired
    private ProducerFactory producerFactory;


    public static void main(String[] args) {
        SpringApplication.run(Application.class);
    }

    @Override
    public void run(String... args) throws Exception {
        producerFactory.sendAsync(TestProducer.DISH_ADD, new Dish(1L, "name"));