@Test void cancelSchedule() { scheduled.put("12345", Event.newBuilder().build()); testSubject.cancelSchedule(new SimpleScheduleToken("12345")); }
@Override public void cancelSchedule(ScheduleToken scheduleToken) { Assert.isTrue(started.get(), () -> "Scheduler is being shutdown"); Assert.isTrue(scheduleToken instanceof SimpleScheduleToken, () -> "Invalid tracking token type. Must be SimpleScheduleToken."); String token = ((SimpleScheduleToken) scheduleToken).getTokenId(); try { InstructionAck instructionAck = eventChannel().cancelSchedule(token) .get(requestTimeout, TimeUnit.MILLISECONDS); if (!instructionAck.getSuccess()) { throw ErrorCode.getFromCode(instructionAck.getError().getErrorCode()) .convert(instructionAck.getError()); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw GrpcExceptionParser.parse(e); } catch (ExecutionException e) { throw GrpcExceptionParser.parse(e.getCause()); } catch (TimeoutException e) { throw GrpcExceptionParser.parse(e); } }
AxonServerEventScheduler implements EventScheduler { @Override public void cancelSchedule(ScheduleToken scheduleToken) { Assert.isTrue(started.get(), () -> "Scheduler is being shutdown"); Assert.isTrue(scheduleToken instanceof SimpleScheduleToken, () -> "Invalid tracking token type. Must be SimpleScheduleToken."); String token = ((SimpleScheduleToken) scheduleToken).getTokenId(); try { InstructionAck instructionAck = eventChannel().cancelSchedule(token) .get(requestTimeout, TimeUnit.MILLISECONDS); if (!instructionAck.getSuccess()) { throw ErrorCode.getFromCode(instructionAck.getError().getErrorCode()) .convert(instructionAck.getError()); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw GrpcExceptionParser.parse(e); } catch (ExecutionException e) { throw GrpcExceptionParser.parse(e.getCause()); } catch (TimeoutException e) { throw GrpcExceptionParser.parse(e); } } }
AxonServerEventScheduler implements EventScheduler { @Override public void cancelSchedule(ScheduleToken scheduleToken) { Assert.isTrue(started.get(), () -> "Scheduler is being shutdown"); Assert.isTrue(scheduleToken instanceof SimpleScheduleToken, () -> "Invalid tracking token type. Must be SimpleScheduleToken."); String token = ((SimpleScheduleToken) scheduleToken).getTokenId(); try { InstructionAck instructionAck = eventChannel().cancelSchedule(token) .get(requestTimeout, TimeUnit.MILLISECONDS); if (!instructionAck.getSuccess()) { throw ErrorCode.getFromCode(instructionAck.getError().getErrorCode()) .convert(instructionAck.getError()); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw GrpcExceptionParser.parse(e); } catch (ExecutionException e) { throw GrpcExceptionParser.parse(e.getCause()); } catch (TimeoutException e) { throw GrpcExceptionParser.parse(e); } } protected  AxonServerEventScheduler(Builder builder); }
AxonServerEventScheduler implements EventScheduler { @Override public void cancelSchedule(ScheduleToken scheduleToken) { Assert.isTrue(started.get(), () -> "Scheduler is being shutdown"); Assert.isTrue(scheduleToken instanceof SimpleScheduleToken, () -> "Invalid tracking token type. Must be SimpleScheduleToken."); String token = ((SimpleScheduleToken) scheduleToken).getTokenId(); try { InstructionAck instructionAck = eventChannel().cancelSchedule(token) .get(requestTimeout, TimeUnit.MILLISECONDS); if (!instructionAck.getSuccess()) { throw ErrorCode.getFromCode(instructionAck.getError().getErrorCode()) .convert(instructionAck.getError()); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw GrpcExceptionParser.parse(e); } catch (ExecutionException e) { throw GrpcExceptionParser.parse(e.getCause()); } catch (TimeoutException e) { throw GrpcExceptionParser.parse(e); } } protected  AxonServerEventScheduler(Builder builder); static Builder builder(); @StartHandler(phase = Phase.OUTBOUND_EVENT_CONNECTORS) void start(); @ShutdownHandler(phase = Phase.OUTBOUND_EVENT_CONNECTORS) void shutdownDispatching(); @Override ScheduleToken schedule(Instant triggerDateTime, Object event); @Override ScheduleToken schedule(Duration triggerDuration, Object event); @Override void cancelSchedule(ScheduleToken scheduleToken); @Override ScheduleToken reschedule(ScheduleToken scheduleToken, Duration triggerDuration, Object event); }
AxonServerEventScheduler implements EventScheduler { @Override public void cancelSchedule(ScheduleToken scheduleToken) { Assert.isTrue(started.get(), () -> "Scheduler is being shutdown"); Assert.isTrue(scheduleToken instanceof SimpleScheduleToken, () -> "Invalid tracking token type. Must be SimpleScheduleToken."); String token = ((SimpleScheduleToken) scheduleToken).getTokenId(); try { InstructionAck instructionAck = eventChannel().cancelSchedule(token) .get(requestTimeout, TimeUnit.MILLISECONDS); if (!instructionAck.getSuccess()) { throw ErrorCode.getFromCode(instructionAck.getError().getErrorCode()) .convert(instructionAck.getError()); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw GrpcExceptionParser.parse(e); } catch (ExecutionException e) { throw GrpcExceptionParser.parse(e.getCause()); } catch (TimeoutException e) { throw GrpcExceptionParser.parse(e); } } protected  AxonServerEventScheduler(Builder builder); static Builder builder(); @StartHandler(phase = Phase.OUTBOUND_EVENT_CONNECTORS) void start(); @ShutdownHandler(phase = Phase.OUTBOUND_EVENT_CONNECTORS) void shutdownDispatching(); @Override ScheduleToken schedule(Instant triggerDateTime, Object event); @Override ScheduleToken schedule(Duration triggerDuration, Object event); @Override void cancelSchedule(ScheduleToken scheduleToken); @Override ScheduleToken reschedule(ScheduleToken scheduleToken, Duration triggerDuration, Object event);  }