modifyPushConfig method

Future<Empty> modifyPushConfig({
  1. required PushConfig pushConfig,
  2. int retries = 5,
  3. required String subscription,
})

Modifies the PushConfig for a specified subscription.

This may be used to change a push subscription to a pull one (signified by an empty PushConfig) or vice versa, or change the endpoint URL and other attributes of a push subscription. Messages will accumulate for delivery continuously through the call regardless of changes to the PushConfig.

The subscription name can be just the simple name or it can be the fully quantified name in the format: projects/{project}/subscriptions/{subscription}.

Implementation

Future<Empty> modifyPushConfig({
  required PushConfig pushConfig,
  int retries = 5,
  required String subscription,
}) async {
  assert(_initialized);
  _logger.fine('[modifyPushConfig]: start -- [$subscription]');

  try {
    return await _execute<Empty>(
      executor: () async {
        return await _pubsubApi.projects.subscriptions.modifyPushConfig(
          ModifyPushConfigRequest(
            pushConfig: pushConfig,
          ),
          subscription.startsWith('projects/')
              ? subscription
              : 'projects/$_projectId/subscriptions/$subscription',
        );
      },
      retries: retries,
    );
  } finally {
    _logger.fine('[modifyPushConfig]: complete -- [$subscription]');
  }
}