parent
d0ae7e61b3
commit
3dd7f2d0af
@ -0,0 +1,10 @@
|
|||||||
|
package cn.iocoder.mall.product.config;
|
||||||
|
|
||||||
|
import cn.iocoder.mall.product.message.MQStreamProducer;
|
||||||
|
import org.springframework.cloud.stream.annotation.EnableBinding;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableBinding(MQStreamProducer.class)
|
||||||
|
public class MQStreamConfiguration {
|
||||||
|
}
|
||||||
@ -0,0 +1,27 @@
|
|||||||
|
package cn.iocoder.mall.product.message;
|
||||||
|
|
||||||
|
import org.springframework.cloud.stream.annotation.Output;
|
||||||
|
import org.springframework.messaging.MessageChannel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spring Cloud Stream Source 接口
|
||||||
|
*/
|
||||||
|
public interface MQStreamProducer {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品更新 Output
|
||||||
|
*/
|
||||||
|
String PRODUCT_UPDATE_OUTPUT = "product-update-output";
|
||||||
|
|
||||||
|
@Output(PRODUCT_UPDATE_OUTPUT)
|
||||||
|
MessageChannel productUpdateOutput();
|
||||||
|
|
||||||
|
// default boolean sendProductUpdateMessage(ProductUpdateMessage message) {
|
||||||
|
// // 创建 Spring Message 对象
|
||||||
|
// Message<ProductUpdateMessage> springMessage = MessageBuilder.withPayload(message)
|
||||||
|
// .build();
|
||||||
|
// // 发送消息
|
||||||
|
// return productUpdateOutput().send(springMessage);
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in new issue