| | |
| | | |
| | | import com.ard.common.config.OssConfiguration; |
| | | import com.ard.oss.model.CredentialsDTO; |
| | | import com.ard.sample.common.error.CommonErrorEnum; |
| | | import com.ard.sample.component.mqtt.model.*; |
| | | import com.ard.sample.component.mqtt.service.IMessageSenderService; |
| | | import com.ard.oss.model.StsCredentialsDTO; |
| | |
| | | @ServiceActivator(inputChannel = ChannelName.INBOUND_REQUESTS_STORAGE_CONFIG_GET, outputChannel = ChannelName.OUTBOUND) |
| | | public void replyConfigGet(CommonTopicReceiver receiver, MessageHeaders headers) { |
| | | // 20251219 这里是获取上传临时凭证的接口,稍候分析下是否满足条件,如果可以的话就直接回复临时凭证即可 |
| | | RequestsReply reply; |
| | | try { |
| | | reply = RequestsReply.success(this.getSTSCredentials()); |
| | | } catch (Exception e) { |
| | | // 机场1 上送 storage_config_get 时,若 MinIO STS 不可用,原实现会直接抛异常且不回复, |
| | | // 机场会每 5 秒重试一次并持续刷 error.log。这里回一个明确的失败应答,避免消息处理中断。 |
| | | // 底层 MinIOServiceImpl 已打印完整堆栈,此处仅记录关键信息。 |
| | | log.error("获取媒体上传临时凭证失败,gateway={},原因:{}", receiver.getGateway(), e.getMessage()); |
| | | reply = RequestsReply.error(CommonErrorEnum.SYSTEM_ERROR); |
| | | } |
| | | CommonTopicResponse<RequestsReply> response = CommonTopicResponse.<RequestsReply>builder() |
| | | .tid(receiver.getTid()) |
| | | .bid(receiver.getBid()) |
| | | .data(RequestsReply.success(this.getSTSCredentials())) |
| | | .data(reply) |
| | | .timestamp(System.currentTimeMillis()) |
| | | .method(RequestsMethodEnum.STORAGE_CONFIG_GET.getMethod()) |
| | | .build(); |