detachSubscription method
Detaches a subscription
from this topic. All messages retained in the
subscription are dropped. Subsequent Pull
and StreamingPull
requests
will return FAILED_PRECONDITION
. If the subscription is a push
subscription, pushes to the endpoint will stop.
The subscription
can be the simple name or the the fully quantified
format: projects/{project}/subscriptions/{subscription}
Implementation
Future<DetachSubscriptionResponse> detachSubscription({
int retries = 5,
required String subscription,
}) async {
assert(_initialized);
_logger.fine('[detachSubscription]: start -- [$subscription]');
try {
return await _execute(
executor: () async {
final result = await _pubsubApi.projects.subscriptions.detach(
subscription.startsWith('projects/')
? subscription
: 'projects/$_projectId/subscriptions/$subscription',
);
return result;
},
retries: retries,
);
} finally {
_logger.fine('[detachSubscription]: complete -- [$subscription]');
}
}