如题,下面贴代码了:public interface StreamClient {
String queueNameIn = "OneMessageIn";
String queueNameOut = "OneMessageOut";
@Input(queueNameIn)
SubscribableChannel input();
@Output(queueNameOut)
MessageChannel output();
}@Component
@EnableBinding({StreamClient.class})
@Slf4j
public class StreamReceiver {
@StreamListener(StreamClient.queueNameIn)
@SendTo(StreamClient.queueNameOut)
public SysUser oneMessageIn(SysUser sysUser) {
log.info("{}", sysUser);
return sysUser;
}
@StreamListener(StreamClient.queueNameOut)
public void oneMessageOut(SysUser sysUser) {
log.info("{}", sysUser.getAvatar());
}
}@RestController
@RequestMapping("/stream")
public class StreamMqController {
@Autowired
private StreamClient streamClient;
@GetMapping("")
public void testQueue(){
SysUser sysUser=new SysUser();
sysUser.setAvatar("1.png");
sysUser.setName("gaojingsi");
streamClient.input().send(MessageBuilder.withPayload(sysUser).build());
}
}启动了两个实例,9090和9091端口,访问9090端口,就是9090收到,访问9091,就是9091收到,想两个实例都收到怎么办啊?
添加回答
举报
0/150
提交
取消