I am trying to create multiple different schedules in java sdk, on a self hosted cluster
Yesterday I created a schedule, then closed the java program, so the scheduled workflow was in the running state, waiting for workers. I terminated the workflow and deleted schedule from the ui.
Later, without any code changes, I am now able to create more than one schedule, from backend java program, with same schedule ID, and not able to view any schedule on the ui.
I even tried to suspend the cluster and restart it, but there was no change.
More over, I am having 2 almost similar functions for scheduling, one is working fine but the other is not, it waas working yesterday though.
Hi thanks,
Could you share the server version and steps to reproduce this? Including code snippets if possible
Thank you,
Antonio
version: temporal version 0.11.0 (server 1.22.4) (ui 2.21.3)
Steps:
- new WorkflowServiceStubs
- new ScheduleClient
- create new schedule by setting arguments, WorkflowType, startAt, endAt, cronExpression, taskQueue, workflowId, scheduleId
I am not able to understand how, but I have two almost identical functions doing scheduling, for one it is visible on UI, but not for the other
The schedule was visible earlier, but suddenly it stopped appearing on the UI
code: " ScheduleClient scheduleClient = ScheduleClient.newInstance(service.getService(),ScheduleClientOptions.newBuilder().setNamespace(temporalNamespace).build());
"
The same scheduleClient creation command is working in one method, but not in other.
I have run into a similar issue when creating a schedule via kotlin sdk, deleting it in the ui manually, and then I am unable to see create/see schedules via sdk anymore:
temporal-ui: 2.15.0
io.tempora:temporal-kotlin:1.20.0
io.temporal:temporal-sdk:1.20.0
temporalio/server:1.20.3
fun createSchedule(
options: WorkflowOptions,
workflowInterface: Class<*>,
scheduleId: String,
cronSchedule: String
): ScheduleHandle {
val service = workflowClient.workflowServiceStubs
val scheduleClient = ScheduleClient.newInstance(service)
val existing = scheduleClient.listSchedules().collect(Collectors.toList()).firstOrNull { it.scheduleId == scheduleId }
if (existing != null) {
return scheduleClient.getHandle(scheduleId)
}
val action = ScheduleActionStartWorkflow.newBuilder()
.setWorkflowType(workflowInterface)
.setOptions(options)
.setArguments()
.build()
val spec = ScheduleSpec.newBuilder()
.setCronExpressions(Collections.singletonList(cronSchedule))
.build()
val schedule = Schedule.newBuilder()
.setAction(action)
.setSpec(spec)
.build()
return scheduleClient.createSchedule(
scheduleId,
schedule,
ScheduleOptions.newBuilder().build()
)
}
Note: this is using the SQLite default db for temporal