Warteschlange aktualisieren
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Beispiel für das Löschen einer Warteschlange für die Migration aus Aufgabenwarteschlangen
Weitere Informationen
Eine ausführliche Dokumentation, die dieses Codebeispiel enthält, finden Sie hier:
Codebeispiel
Nächste Schritte
Wenn Sie nach Codebeispielen für andere Google Cloud -Produkte suchen und filtern möchten, können Sie den Google Cloud -Beispielbrowser verwenden.
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],[],[],[],null,["# Update a queue\n\nUpdates a queue for migrating from taskqueues example.\n\nExplore further\n---------------\n\n\nFor detailed documentation that includes this code sample, see the following:\n\n- [Migrating push queues to Cloud Tasks (Java)](/appengine/migration-center/standard/java/migrating-push-queues)\n- [Migrating push queues to Cloud Tasks (Python)](/appengine/migration-center/standard/python/migrating-push-queues)\n\nCode sample\n-----------\n\n### Java\n\n\nTo learn how to install and use the client library for Cloud Tasks, see\n[Cloud Tasks client libraries](/tasks/docs/reference/libraries).\n\n\nTo authenticate to Cloud Tasks, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n import com.google.cloud.tasks.v2.https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.CloudTasksClient.html;\n import com.google.cloud.tasks.v2.https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.LocationName.html;\n import com.google.cloud.tasks.v2.https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.Queue.html;\n import com.google.cloud.tasks.v2.https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.QueueName.html;\n import com.google.cloud.tasks.v2.https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.RateLimits.html;\n import com.google.cloud.tasks.v2.https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.UpdateQueueRequest.html;\n\n public class UpdateQueue {\n public static void updateQueue(String projectId, String locationId, String queueId)\n throws Exception {\n try (https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.CloudTasksClient.html client = https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.CloudTasksClient.html.create()) {\n // TODO(developer): Uncomment these lines and replace with your values.\n // String projectId = \"your-project-id\";\n // String locationId = \"us-central1\";\n // String queueId = \"queue-blue\";\n\n https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.LocationName.html parent = https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.LocationName.html.of(projectId, locationId);\n\n https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.Queue.html queueBlue =\n https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.Queue.html.newBuilder()\n .setName(https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.QueueName.html.of(projectId, locationId, queueId).toString())\n .https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.Queue.Builder.html#com_google_cloud_tasks_v2_Queue_Builder_setRateLimits_com_google_cloud_tasks_v2_RateLimits_(\n https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.RateLimits.html.newBuilder()\n .https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.RateLimits.Builder.html#com_google_cloud_tasks_v2_RateLimits_Builder_setMaxDispatchesPerSecond_double_(20.0)\n .https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.RateLimits.Builder.html#com_google_cloud_tasks_v2_RateLimits_Builder_setMaxConcurrentDispatches_int_(10))\n .build();\n\n https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.UpdateQueueRequest.html request = https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.UpdateQueueRequest.html.newBuilder().setQueue(queueBlue).build();\n\n https://cloud.google.com/java/docs/reference/google-cloud-tasks/latest/com.google.cloud.tasks.v2.Queue.html response = client.updateQueue(request);\n System.out.println(response);\n }\n }\n }\n\n### Python\n\n\nTo learn how to install and use the client library for Cloud Tasks, see\n[Cloud Tasks client libraries](/tasks/docs/reference/libraries).\n\n\nTo authenticate to Cloud Tasks, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n client = tasks.CloudTasksClient()\n\n # TODO(developer): Uncomment these lines and replace with your values.\n # project = 'my-project-id'\n # location = 'us- central1'\n # queue = 'queue-blue'\n\n # Get queue object\n queue_path = client.queue_path(project, location, queue)\n queue = client.get_queue(name=queue_path)\n\n # Update queue object\n queue.rate_limits.max_dispatches_per_second = 20\n queue.rate_limits.max_concurrent_dispatches = 10\n\n response = client.update_queue(queue=queue)\n print(response)\n\nWhat's next\n-----------\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=cloud_tasks)."]]