Java 8은 지원이 종료되었으며 2026년 1월 31일에 지원 중단됩니다. 지원 중단 후에는 조직에서 이전에 조직 정책을 사용하여 레거시 런타임의 배포를 다시 사용 설정한 경우에도 Java 8 애플리케이션을 배포할 수 없습니다. 기존 Java 8 애플리케이션은 지원 중단 날짜 이후에도 계속 실행되고 트래픽을 수신합니다. 지원되는 최신 Java 버전으로 마이그레이션하는 것이 좋습니다.
<!-- A basic index.html file served from the "/" URL. -->
<html>
<body>
<p>Enqueue a value, to be processed by a worker.</p>
<form action="/enqueue" method="post">
<input type="text" name="key">
<input type="submit">
</form>
</body>
</html>
Enqueue.java:
// The Enqueue servlet should be mapped to the "/enqueue" URL.// With @WebServlet annotation the webapp/WEB-INF/web.xml is no longer required.@WebServlet(name="TaskEnque",description="taskqueue: Enqueue a job with a key",urlPatterns="/taskqueues/enqueue")publicclassEnqueueextendsHttpServlet{protectedvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{Stringkey=request.getParameter("key");// Add the task to the default queue.Queuequeue=QueueFactory.getDefaultQueue();queue.add(TaskOptions.Builder.withUrl("/worker").param("key",key));response.sendRedirect("/");}}
Worker.java:
// The Worker servlet should be mapped to the "/worker" URL.// With @WebServlet annotation the webapp/WEB-INF/web.xml is no longer required.@WebServlet(name="TaskWorker",description="TaskQueues: worker",urlPatterns="/taskqueues/worker")publicclassWorkerextendsHttpServlet{privatestaticfinalLoggerlog=Logger.getLogger(Worker.class.getName());protectedvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)throwsServletException,IOException{Stringkey=request.getParameter("key");// Do something with key.// ...}}
이 큐에 추가된 태스크는 URL /worker에서 매개변수 key로 요청 핸들러를 호출하여 실행됩니다. queue.xml 파일에 설정된 속도 또는 초당 태스크 5개의 기본 속도로 실행됩니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eThis content demonstrates how to add a task to a queue using legacy bundled services and APIs within the first-generation App Engine standard environment.\u003c/p\u003e\n"],["\u003cp\u003eThe provided \u003ccode\u003eindex.html\u003c/code\u003e includes a form to submit a value (\u003ccode\u003ekey\u003c/code\u003e) to the \u003ccode\u003e/enqueue\u003c/code\u003e URL for task queuing.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eEnqueue.java\u003c/code\u003e servlet handles POST requests to \u003ccode\u003e/taskqueues/enqueue\u003c/code\u003e, adding tasks with the provided \u003ccode\u003ekey\u003c/code\u003e to the default queue.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eWorker.java\u003c/code\u003e servlet, mapped to \u003ccode\u003e/taskqueues/worker\u003c/code\u003e, processes the tasks, receiving the \u003ccode\u003ekey\u003c/code\u003e parameter for execution.\u003c/p\u003e\n"],["\u003cp\u003eTasks in the queue are executed by calling the \u003ccode\u003e/worker\u003c/code\u003e request handler, with the rate determined by the \u003ccode\u003equeue.xml\u003c/code\u003e file or defaulting to 5 tasks per second.\u003c/p\u003e\n"]]],[],null,["# A Java Task Queue Example\n\nThe following code adds a task to a queue with options.\n| This page describes how to use the legacy bundled services and APIs. This API can only run in first-generation runtimes in the App Engine standard environment. If you are updating to the App Engine Java 11/17 runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/java-differences) to learn about your migration options for legacy bundled services.\n\n\u003cbr /\u003e\n\nIn `index.html`: \n\n \u003c!-- A basic index.html file served from the \"/\" URL. --\u003e\n \u003chtml\u003e\n \u003cbody\u003e\n \u003cp\u003eEnqueue a value, to be processed by a worker.\u003c/p\u003e\n \u003cform action=\"/enqueue\" method=\"post\"\u003e\n \u003cinput type=\"text\" name=\"key\"\u003e\n \u003cinput type=\"submit\"\u003e\n \u003c/form\u003e\n \u003c/body\u003e\n \u003c/html\u003e\n\nIn `Enqueue.java`: \n\n // The Enqueue servlet should be mapped to the \"/enqueue\" URL.\n // With @WebServlet annotation the webapp/WEB-INF/web.xml is no longer required.\n @WebServlet(\n name = \"TaskEnque\",\n description = \"taskqueue: Enqueue a job with a key\",\n urlPatterns = \"/taskqueues/enqueue\"\n )\n public class Enqueue extends HttpServlet {\n\n protected void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n String key = request.getParameter(\"key\");\n\n // Add the task to the default queue.\n Queue queue = QueueFactory.getDefaultQueue();\n queue.add(TaskOptions.Builder.withUrl(\"/worker\").param(\"key\", key));\n\n response.sendRedirect(\"/\");\n }\n }\n\nIn `Worker.java`: \n\n // The Worker servlet should be mapped to the \"/worker\" URL.\n // With @WebServlet annotation the webapp/WEB-INF/web.xml is no longer required.\n @WebServlet(\n name = \"TaskWorker\",\n description = \"TaskQueues: worker\",\n urlPatterns = \"/taskqueues/worker\"\n )\n public class Worker extends HttpServlet {\n\n private static final Logger log = Logger.getLogger(Worker.class.getName());\n\n protected void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n String key = request.getParameter(\"key\");\n\n // Do something with key.\n // ...\n }\n }\n\nTasks added to this queue will execute by calling the request handler at the URL `/worker` with the parameter `key`. They will execute at the rate set in the `queue.xml` file, or the default rate of 5 tasks per second."]]