第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何保證該工作在開始IntegrationFlow的下一步之前完成?

如何保證該工作在開始IntegrationFlow的下一步之前完成?

郎朗坤 2023-07-13 14:33:29
我有以下流程聲明:return flow -> flow.handle(myHandler)                                .handle(springBatchJobLauncher)                              .gateway(acknowledgementFlow);啟動器看起來像這樣:@ServiceActivatorpublic JobExecution launch(JobLaunchRequest request) throws JobExecutionException {    Job job = request.getJob();    JobParameters jobParameters = request.getJobParameters();    return jobLauncher.run(job, jobParameters);}我需要acknowledgementFlow在開始的工作完成后立即開始springBatchJobLauncher。按照這個配置能保證嗎?
查看完整描述

1 回答

?
夢里花落0921

TA貢獻1772條經(jīng)驗 獲得超6個贊

讓我們看一下JobLauncher.run()JavaDocs!


?* Start a job execution for the given {@link Job} and {@link JobParameters}

?* . If a {@link JobExecution} was able to be created successfully, it will

?* always be returned by this method, regardless of whether or not the

?* execution was successful. If there is a past {@link JobExecution} which

?* has paused, the same {@link JobExecution} is returned instead of a new

?* one created. A exception will only be thrown if there is a failure to

?* start the job. If the job encounters some error while processing, the

?* JobExecution will be returned, and the status will need to be inspected.

因此,如果工作已成功開始,您將獲得一個JobExecution對象,但這實際上與您的工作是否完成無關(guān)。為了實現(xiàn)這個目標,我相信我們需要像JobExecutionListenerhook 這樣的東西。


有一個示例step:


@MessagingGateway(name = "notificationExecutionsListener", defaultRequestChannel = "stepExecutionsChannel")

public interface NotificationExecutionListener extends StepExecutionListener {}

但同樣的方法也適用于JobExecutionListener.


因此,您需要將流程分成兩部分,并.gateway(acknowledgementFlow)僅從afterJob(JobExecution jobExecution)您的工作中執(zhí)行的任務(wù)中進行調(diào)用。


查看完整回答
反對 回復 2023-07-13
  • 1 回答
  • 0 關(guān)注
  • 100 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號