309.9. 异常处理

这个组件支持常规 Camel 异常处理功能

当发生错误时,使用 SubmitSm (默认操作)发送消息时,org.apache.camel.component.smpp.SmppException 会引发嵌套异常,即 org.jsmpp.extra.NegativeResponseException。  调用 NegativeResponseException.getCommandStatus ()以获取精确的 SMPP 负响应代码,其值在 SMPP 规范 3.4 节中阐述。
发布的 Camel 2.8 :当 SMPP 使用者收到 交付SmDataSm 短消息并且这些消息的处理失败时,您也可以抛出 ProcessRequestException 而不是处理失败。在这种情况下,这个例外会转发到底层 JSMPP 库,该库 会将包括的错误代码返回到 SMSC。此功能对 e.g. 指示 SMSC 稍后重新发送简短消息。这可以通过以下代码行完成:

from("smpp://smppclient@localhost:2775?password=password&enquireLinkTimer=3000&transactionTimer=5000&systemType=consumer")
  .doTry()
    .to("bean:dao?method=updateSmsState")
  .doCatch(Exception.class)
    .throwException(new ProcessRequestException("update of sms state failed", 100))
  .end();

有关错误代码的完整列表及其含义,请参阅 SMPP 规格