Я пытаюсь создать вечный оркестратор, но у меня ничего не получается.
Вот фрагмент моего кода.
HTTP-триггер
@FunctionName("MQMessageOrchestrate")
public HttpResponseMessage mqMessageOrchestrate(
@HttpTrigger(name = "req", methods = { HttpMethod.GET,
HttpMethod.POST }, authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage request,
@DurableClientInput(name = "durableContext") DurableClientContext durableContext,
final ExecutionContext context) {
context.getLogger().info("Java HTTP trigger processed a request.");
// Initialize durable task client
DurableTaskClient client = durableContext.getClient();
// Start orchestration
String instanceId = client.scheduleNewOrchestrationInstance("TestOrchestrator");
// Output instance id
context.getLogger().info("Created new Java orchestration with instance ID = " + instanceId);
// Return status of orchestration in response
return durableContext.createCheckStatusResponse(request, instanceId);
}
Оркестратор
@FunctionName("TestOrchestrator")
public void testOrchestrator(
@DurableOrchestrationTrigger(name = "ctx") TaskOrchestrationContext ctx, ExecutionContext context) {
System.out.println("Processing stuff...");
ctx.createTimer(Duration.ofSeconds(5)).await();
ctx.continueAsNew(null);
}
Ожидание
Я ожидал, что оркестратор повторит, я видел аналогичный код, который не создает та же ошибка, но я не могу понять, в чем дело.
[2024-12-05T01:54:00.002Z] Created new Java orchestration with instance ID = d14eec3b-aad1-4508-92df-32d883201a40
[2024-12-05T01:54:00.011Z] Function "MQMessageOrchestrate" (Id: c125b1d3-35d7-428f-a831-1afe7903eeae) invoked by Java Worker
[2024-12-05T01:54:00.036Z] Executing 'Functions.TestOrchestrator' (Reason='(null)', Id=a087455b-a3ff-4b41-904f-c468d693d7dd)
[2024-12-05T01:54:00.042Z] Executed 'Functions.MQMessageOrchestrate' (Succeeded, Id=c125b1d3-35d7-428f-a831-1afe7903eeae, Duration=833ms)
[2024-12-05T01:54:00.064Z] Processing stuff...
[2024-12-05T01:54:00.078Z] Function "TestOrchestrator" (Id: a087455b-a3ff-4b41-904f-c468d693d7dd) invoked by Java Worker
[2024-12-05T01:54:00.085Z] Executed 'Functions.TestOrchestrator' (Succeeded, Id=a087455b-a3ff-4b41-904f-c468d693d7dd, Duration=57ms)
[2024-12-05T01:54:06.686Z] Executing 'Functions.TestOrchestrator' (Reason='(null)', Id=b8aff574-c31f-4e7a-8269-571d303ec402)
[2024-12-05T01:54:06.693Z] Processing stuff...
[2024-12-05T01:54:00.078Z] Function "TestOrchestrator" (Id: a087455b-a3ff-4b41-904f-c468d693d7dd) invoked by Java Worker
[2024-12-05T01:54:00.085Z] Executed 'Functions.TestOrchestrator' (Succeeded, Id=a087455b-a3ff-4b41-904f-c468d693d7dd, Duration=57ms)
[2024-12-05T01:54:06.686Z] Executing 'Functions.TestOrchestrator' (Reason='(null)', Id=b8aff574-c31f-4e7a-8269-571d303ec402)
[2024-12-05T01:54:06.693Z] Processing stuff...
Реальность
Но именно это и произошло после первой оркестровки. В ошибке говорится, что оркестратор уже завершил работу.
[2024-12-05T01:54:06.693Z] Processing stuff...
[2024-12-05T01:54:06.714Z] Executed 'Functions.TestOrchestrator' (Failed, Id=b8aff574-c31f-4e7a-8269-571d303ec402, Duration=27ms)
[2024-12-05T01:54:06.715Z] System.Private.CoreLib: Exception while executing function: Functions.TestOrchestrator. System.Private.CoreLib: Result: Failure
Exception: IllegalStateException: The orchestrator has already completed
Stack: java.lang.IllegalStateException: The orchestrator has already completed
Подробнее здесь: https://stackoverflow.com/questions/792 ... hestration
Лазурь — вечная оркестровка ⇐ JAVA
Программисты JAVA общаются здесь
1733486143
Anonymous
Я пытаюсь создать вечный оркестратор, но у меня ничего не получается.
Вот фрагмент моего кода.
[b]HTTP-триггер[/b]
@FunctionName("MQMessageOrchestrate")
public HttpResponseMessage mqMessageOrchestrate(
@HttpTrigger(name = "req", methods = { HttpMethod.GET,
HttpMethod.POST }, authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage request,
@DurableClientInput(name = "durableContext") DurableClientContext durableContext,
final ExecutionContext context) {
context.getLogger().info("Java HTTP trigger processed a request.");
// Initialize durable task client
DurableTaskClient client = durableContext.getClient();
// Start orchestration
String instanceId = client.scheduleNewOrchestrationInstance("TestOrchestrator");
// Output instance id
context.getLogger().info("Created new Java orchestration with instance ID = " + instanceId);
// Return status of orchestration in response
return durableContext.createCheckStatusResponse(request, instanceId);
}
[b]Оркестратор[/b]
@FunctionName("TestOrchestrator")
public void testOrchestrator(
@DurableOrchestrationTrigger(name = "ctx") TaskOrchestrationContext ctx, ExecutionContext context) {
System.out.println("Processing stuff...");
ctx.createTimer(Duration.ofSeconds(5)).await();
ctx.continueAsNew(null);
}
[b]Ожидание[/b]
Я ожидал, что оркестратор повторит, я видел аналогичный код, который не создает та же ошибка, но я не могу понять, в чем дело.
[2024-12-05T01:54:00.002Z] Created new Java orchestration with instance ID = d14eec3b-aad1-4508-92df-32d883201a40
[2024-12-05T01:54:00.011Z] Function "MQMessageOrchestrate" (Id: c125b1d3-35d7-428f-a831-1afe7903eeae) invoked by Java Worker
[2024-12-05T01:54:00.036Z] Executing 'Functions.TestOrchestrator' (Reason='(null)', Id=a087455b-a3ff-4b41-904f-c468d693d7dd)
[2024-12-05T01:54:00.042Z] Executed 'Functions.MQMessageOrchestrate' (Succeeded, Id=c125b1d3-35d7-428f-a831-1afe7903eeae, Duration=833ms)
[2024-12-05T01:54:00.064Z] Processing stuff...
[2024-12-05T01:54:00.078Z] Function "TestOrchestrator" (Id: a087455b-a3ff-4b41-904f-c468d693d7dd) invoked by Java Worker
[2024-12-05T01:54:00.085Z] Executed 'Functions.TestOrchestrator' (Succeeded, Id=a087455b-a3ff-4b41-904f-c468d693d7dd, Duration=57ms)
[2024-12-05T01:54:06.686Z] Executing 'Functions.TestOrchestrator' (Reason='(null)', Id=b8aff574-c31f-4e7a-8269-571d303ec402)
[2024-12-05T01:54:06.693Z] Processing stuff...
[2024-12-05T01:54:00.078Z] Function "TestOrchestrator" (Id: a087455b-a3ff-4b41-904f-c468d693d7dd) invoked by Java Worker
[2024-12-05T01:54:00.085Z] Executed 'Functions.TestOrchestrator' (Succeeded, Id=a087455b-a3ff-4b41-904f-c468d693d7dd, Duration=57ms)
[2024-12-05T01:54:06.686Z] Executing 'Functions.TestOrchestrator' (Reason='(null)', Id=b8aff574-c31f-4e7a-8269-571d303ec402)
[2024-12-05T01:54:06.693Z] Processing stuff...
[b]Реальность[/b]
Но именно это и произошло после первой оркестровки. В ошибке говорится, что оркестратор уже завершил работу.
[2024-12-05T01:54:06.693Z] Processing stuff...
[2024-12-05T01:54:06.714Z] Executed 'Functions.TestOrchestrator' (Failed, Id=b8aff574-c31f-4e7a-8269-571d303ec402, Duration=27ms)
[2024-12-05T01:54:06.715Z] System.Private.CoreLib: Exception while executing function: Functions.TestOrchestrator. System.Private.CoreLib: Result: Failure
Exception: IllegalStateException: The orchestrator has already completed
Stack: java.lang.IllegalStateException: The orchestrator has already completed
Подробнее здесь: [url]https://stackoverflow.com/questions/79254113/azure-eternal-orchestration[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия