com.eworkcloud.rocket.RocketConfiguration Maven / Gradle / Ivy
package com.eworkcloud.rocket;
import com.aliyun.mq.http.MQClient;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.annotation.Resource;
@Configuration
@EnableConfigurationProperties(RocketProperties.class)
public class RocketConfiguration {
@Resource
private RocketProperties rocketProperties;
@Bean
public MQClient mqClient() {
return new MQClient(rocketProperties.getNameAddr(), rocketProperties.getAccessKey(), rocketProperties.getSecretKey());
}
@Bean
@ConditionalOnBean(MQClient.class)
public RocketTemplate rocketTemplate(MQClient mqClient) {
return new RocketTemplate(rocketProperties, mqClient);
}
@Bean
@ConditionalOnBean(MQClient.class)
public RocketProcessor rocketProcessor(MQClient mqClient) {
return new RocketProcessor(rocketProperties, mqClient);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy