SharedConfiguration.java 1.22 KB
package com.diligrp.etrade.shared;

import com.diligrp.etrade.core.mybatis.MybatisMapperSupport;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@ComponentScan("com.diligrp.etrade.shared")
@MapperScan(basePackages =  {"com.diligrp.etrade.shared.dao"}, markerInterface = MybatisMapperSupport.class)
public class SharedConfiguration {
    /**
     * MQ_STOCK_EXCHANGE
     */
    public static final String MQ_STOCK_EXCHANGE = "dili.stock.exchange.xtrade";

    /**
     * MQ_ORDER_EXCHANGE
     */
    public static final String MQ_ORDER_EXCHANGE = "dili.order.exchange.xtrade";

    /**
     * stockExchange
     *
     * @return {@link FanoutExchange}
     */
    @Bean
    public FanoutExchange stockExchange() {
        return new FanoutExchange(MQ_STOCK_EXCHANGE, true, false);
    }

    /**
     * orderExchange
     *
     * @return {@link FanoutExchange}
     */
    @Bean
    public FanoutExchange orderExchange() {
        return new FanoutExchange(MQ_ORDER_EXCHANGE, true, false);
    }

}