apache / rocketmq-spring

Apache RocketMQ Spring Integration
https://rocketmq.apache.org/
Apache License 2.0
2.09k stars 894 forks source link

Ugly code #667

Closed x-wk closed 1 month ago

x-wk commented 1 month ago

      try {
         Message<?> message = MessageBuilder.withPayload(payloadBuilder.build())
            .setHeader(RocketMQHeaders.KEYS, keys)
            .build();

         // send
         SendReceipt sendReceipt = rocketMQClientTemplate.syncSendNormalMessage(MQTopics.XXX_TOPIC, message);

         // no exception?
         if (sendReceipt == null) {
            throw new RuntimeError("1111", "Failure");
         }
      } catch (Exception e) {
         throw new RuntimeError("1111", "Failure");
      }

Ugly...🤮