diff options
author | Zach Smith <zach@driver.xyz> | 2018-09-05 13:32:12 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-05 13:32:12 -0700 |
commit | 93ffc0a5c4b54a8beea10c3fd68e7a2d70c4c771 (patch) | |
tree | 91d9e0a73f7b88785c8471e3ac282f3dbf821e32 /src/main/scala/xyz/driver | |
parent | 9083026ac05b0674c9e235ce3efba8990fdabce7 (diff) | |
download | driver-core-1.13.4.tar.gz driver-core-1.13.4.tar.bz2 driver-core-1.13.4.zip |
Catch MessageNotExist errors in alicloud subscriptions to prevent errors on timeout (#210)v1.13.4
Diffstat (limited to 'src/main/scala/xyz/driver')
-rw-r--r-- | src/main/scala/xyz/driver/core/messaging/AliyunBus.scala | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/scala/xyz/driver/core/messaging/AliyunBus.scala b/src/main/scala/xyz/driver/core/messaging/AliyunBus.scala index 66ae377..27e66f6 100644 --- a/src/main/scala/xyz/driver/core/messaging/AliyunBus.scala +++ b/src/main/scala/xyz/driver/core/messaging/AliyunBus.scala @@ -3,6 +3,7 @@ import java.nio.ByteBuffer import java.util import com.aliyun.mns.client.{AsyncCallback, CloudAccount} +import com.aliyun.mns.common.ServiceException import com.aliyun.mns.model import com.aliyun.mns.model._ @@ -53,7 +54,11 @@ class AliyunBus( pullTimeout, new AsyncCallback[util.List[model.Message]] { override def onSuccess(result: util.List[model.Message]): Unit = promise.success(result.asScala) - override def onFail(ex: Exception): Unit = promise.failure(ex) + override def onFail(ex: Exception): Unit = ex match { + case serviceException: ServiceException if serviceException.getErrorCode == "MessageNotExist" => + promise.success(Nil) + case _ => promise.failure(ex) + } } ) |