Move errors to pseudo constant
@@ -70,6 +70,20 @@ const (
defaultPublishInitialRetryInternalInMs = 500
)
+var retriableSendingErrors = map[amqp.ErrorCondition]struct{}{
+ "com.microsoft:server-busy'": {},
+ amqp.ErrorResourceLimitExceeded: {},
+ amqp.ErrorResourceLocked: {},
+ amqp.ErrorTransferLimitExceeded: {},
+ amqp.ErrorInternalError: {},
+ amqp.ErrorIllegalState: {},
+ "com.microsoft:message-lock-lost": {},
+ "com.microsoft:session-cannot-be-locked": {},
+ "com.microsoft:timeout": {},
+ "com.microsoft:session-lock-lost": {},
+ "com.microsoft:store-lock-lost": {},
+}
+
type handle = struct{}
type azureServiceBus struct {
@@ -365,20 +379,6 @@ func (a *azureServiceBus) doPublish(sender *azservicebus.Topic, msg *azservicebu
return nil
}
- retriableSendingErrors := map[amqp.ErrorCondition]struct{}{
- "com.microsoft:server-busy'": {},
- amqp.ErrorResourceLimitExceeded: {},
- amqp.ErrorResourceLocked: {},
- amqp.ErrorTransferLimitExceeded: {},
- amqp.ErrorInternalError: {},
- amqp.ErrorIllegalState: {},
- "com.microsoft:message-lock-lost": {},
- "com.microsoft:session-cannot-be-locked": {},
- "com.microsoft:timeout": {},
- "com.microsoft:session-lock-lost": {},
- "com.microsoft:store-lock-lost": {},
- }
-
var amqpError *amqp.Error
if errors.As(err, &amqpError) {
if _, ok := retriableSendingErrors[amqpError.Condition]; ok {
