问题标签 [spring-cloud-task]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1686 浏览

spring - Spring Data Flow 在启动时覆盖作业参数

我目前在 Spring Cloud Data Flow 中的 Tasks 调用遇到问题。

我有一个在 SCDF 上注册的 Spring Batch(包含单任务步骤作业)应用程序和一个基于此应用程序的任务定义。在我第一次启动此任务期间,我使用了几个作业参数/参数。由于我现在知道的一个原因,我所有的后续启动都被我使用的第一组参数覆盖。

我正在使用 SCDF 1.4.0 + MSSQL 数据库,但是使用 SCDF 1.3.2 + H2 或 MSSQL 也会发生同样的行为。

批处理配置.java

TaskletStep.java:

我的启动命令:

申请日志:

2018-04-04 13:33:28 [main] INFO cbgnBatchNegativacaoApp - 在 13.938 秒内启动 BatchNegativacaoApp(JVM 运行时间为 14.599)

2018-04-04 13:33:28 [main] INFO osbabJobLauncherCommandLineRunner - 使用以下命令运行默认命令行:[filePath=/tmp/jars/remessa.txt,informante=Caixa,--spring.cloud.task.closecontext_enable=false, --spring.cloud.task.executionid=17]

2018-04-04 13:33:28 [main] INFO osbclsupport.SimpleJobLauncher - Job: [SimpleJob: [name=job]] 使用以下参数启动:[{filePath=/home/enrico/PROJETOS/GIC/java/ remessa.txt, -spring.cloud.task.executionid=8, informante=Caixa, -spring.cloud.task.closecontext_enable=false, run.id=12, time=1522842134819}]

你们知道为什么会发生吗?

感谢您的关注和任何意见!

最好的问候,恩里科

0 投票
0 回答
750 浏览

migration - 在历史 Spring Batch 数据已经存在后引入 Tasks 使用时 Spring Batch/Task Repository 数据不匹配

我的项目有 20 多个使用 Spring Batch 构建的批处理作业,并且已经投入生产几年了。我们目前正在将它们迁移到使用 Spring Batch 和 Spring Cloud Task 构建的单个 Spring Boot 应用程序中。然后这些将部署为 Spring Cloud Dataflow 中的任务并部署到 PCF。

鉴于这些作业(仅使用 Spring Batch)已经投入生产,Batch Repository 表包含大量过去执行的数据。当我们部署新迁移的作业(引入 Task 表)时,Batch 表和 Task 表之间的数据将不匹配,因为 Task 表将是新创建的,因此是空的。虽然这不会阻止我们运行新的作业执行,但它确实会阻止我们使用 Spring Cloud Dataflow 中的“作业”选项卡。这是因为为了加载页面,它会查询 TASK_TASK_BATCH 表,试图匹配job_execution_id每个task_execution_id. 这会引发其他帖子中提到的臭名昭著的 NullPointerException (数据流任务不适用于 Spring Batch),而每个job_execution_id.

所以我的问题是,对于任何已经使用 Spring Batch 并且正在迁移相同工作以也使用 Spring Cloud Task 的团队来说,解决这种差异的正确方法是什么?Spring 是否提供了任何流程来解决这个问题?理想情况下,我们希望将过去批处理作业执行的数据保留在批处理存储库表中,我们不想删除它。那么我们是否必须在任务表中制作“匹配”的虚拟数据来消除这种差异?

谢谢你。

0 投票
1 回答
883 浏览

spring - 在 Spring Cloud Dataflow 中运行批处理任务时出现 JobInstanceAlreadyCompleteException

我有一个批处理作业,在 Spring Cloud 数据流中作为任务工作。当我第二次尝试执行相同的任务定义时,我得到了异常:

我的作业配置如下所示:

据我所知, JobParametersIncrementor 应该通过向参数添加递增的 runId 来修复此异常。但在我的情况下,我只能在服务器上运行一次作业,然后我必须清除数据库(mysql)并且 RunId 在数据库中不存在。

0 投票
0 回答
2929 浏览

java - Spring Cloud 启动任务:AnnotationConfigApplicationContext 已经关闭

使用 Spring Boot 应用程序使用 Spring Batch 和 Spring Cloud 任务构建新项目。

在与 Spring Cloud Flow Tasks 集成时出现以下错误。

这是错误:

java.lang.IllegalStateException: org.springframework.context.annotation.AnnotationConfigApplicationContext@45c2f888 已经在 org.springframework.context.support.AbstractApplicationContext.assertBeanFactoryActive(AbstractApplicationContext.java:1073) 在 org.springframework.context.support.AbstractApplicationContext 关闭org.springframework.boot.devtools.autoconfigure.ConditionEvaluationDeltaLoggingListener.onApplicationEvent(ConditionEvaluationDeltaLoggingListener.java:33) 的 .getBean(AbstractApplicationContext.java:1106) ) 在 org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) 在 org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) 在 org.springframework.context.support.AbstractApplicationContext 的 org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) .publishEvent(AbstractApplicationContext.java:400) 在 org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:354) 在 org.springframework.boot.context.event.EventPublishingRunListener.running(EventPublishingRunListener.java:103) 在org.springframework.boot.SpringApplicationRunListeners.running(SpringApplicationRunListeners.java:78) 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:343) 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) at com.ranker.batch_v2.BatchV2Application.main(BatchV2Application.java:14) at sun .reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在 java.lang.reflect.Method.invoke (Method.java:498) 在 org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)java:14) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在 java.lang .reflect.Method.invoke(Method.java:498) 在 org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)java:14) 在 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 在 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在 java.lang .reflect.Method.invoke(Method.java:498) 在 org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)

用于构建项目的 POM 配置:

请建议我解决问题,对时间敏感的任何帮助将不胜感激。

0 投票
2 回答
215 浏览

java - TaskConfigurer 不考虑数据源的架构名称

我有 2 个数据源。对于一个数据源,我想使用自定义模式名称。出于这个原因,我将我的数据源 url 设置为 spring.datasource.url=jdbc:postgresql://192.168.33.10/analytics?currentSchema=bahmni_mart_scdf. 但它在公共模式中创建所有表,而不是bahmni_mart_scdf模式。

我已经覆盖了 TaskRepositoryInitializer bean 并实现了 TaskConfigurer。

这是我的实现

数据库配置.class

DataloadTaskConfigurer.class

任务配置.class

应用程序属性

0 投票
1 回答
1022 浏览

spring - 数据流服务器上的 Spring 云任务与 @EnableTask

我是 Spring 云数据流的新手。试图通过注册来弄清楚它的含义,在spring云数据流服务器上创建一个任务与运行一个带有注释@EnableTask的spring类。任何澄清这两个是什么,都会有所帮助!

0 投票
3 回答
917 浏览

spring-batch - Spring Cloud Dataflow - 如何将凭据传递给任务

我使用部署到关键云代工厂的 Spring Cloud 数据流,将 Spring Batch 作业作为 Spring Cloud 任务运行,并且这些作业需要 aws 凭据才能访问 s3 存储桶。

我尝试将 aws 凭据作为任务属性传递,但凭据在任务的日志文件中显示为参数或属性。(https://docs.spring.io/spring-cloud-dataflow/docs/current/reference/htmlsingle/#spring-cloud-dataflow-global-properties

现在,我在每次部署后手动将凭据设置为 pcf 中的 env 变量,但我正在尝试自动执行此操作。在实际启动任务之前不会部署任务,因此在部署时我必须启动任务,然后等待它由于缺少凭据而失败,然后使用cfcli 设置环境变量凭据。我如何提供这些凭据,而不显示在 pcf 应用程序的日志中?

我也探索过使用 vault 和 spring cloud config,但同样,我需要将凭据传递给任务以访问 spring cloud config。

谢谢!

0 投票
1 回答
600 浏览

spring-batch - Running a spring batch with partitions in cloud foundry

I have created an app with spring batch(with partition) application taking example of this https://github.com/mminella/S3JDBC. My app is reading some files from object store and doing some processing and writing back to object the store. My app with local partition works fine in my machine.

I changed the maven, to run in cloud foundry , did change for deployer partition handler and step execution listener and deploying on pcf.

But while trying to push and run the app on pcf , I am getting an issue : Failing URI /v2/info. I tried to log the error found that there is one call to my app e.g https://mypcf.com:443/v2/info and after that it gives the error. I cant provide full logs because of some restrictions. So I want to know :

  1. To deploy a spring batch in pcf(is there any extra configuration needed except the maven dependency and code changes for deployerpartitionhandler and stepexecutionlistener and @cloudtask): org.springframework.cloud spring-cloud-deployer-cloudfoundry 1.1.0.M1
  2. Is it mandatory to have a separate data base service like my-sql for the partition job. Cant I use H2(the default one, if I don't configure anything)?
  3. Do I need to do any configuration in pcf to support running multiple partitions ?
  4. As I am running remote partitioning , can I run that app on local STS or Intellij(not on PCF-DEV)so that it will run my app in pcf(remote) and launch the workers.(Sorry for the stupid question , I am new to PCF).
0 投票
2 回答
3005 浏览

cron - Cron 作业微服务

我正在使用 Spring Cloud,并为在线购物供应商提供各种微服务。一切都按预期工作。

但是,我有一个要求,我需要对客户的记录运行 cron 作业,获取客户的谁的声明日期与当前日期匹配并计算要支付的利率。这需要每天运行。

我对如何使用 MS 架构来适应这个 cron 作业感到困惑。我是否需要另一台只有这个 cron 工作的服务器?

0 投票
1 回答
113 浏览

spring - Run and close child context from parent app

I'm using spring application builder to run child context application (spring Cloud task) from parent. I'm also passing running parent context to the builder of child application - it has DataSource bean defined and I want it to be used by task as well.

My problem is that when the child context is closed, all parent bean are also destroyed. Am I doing something wrong?

How can I share beans from parent context with child and still keep them alive when the child context exits.

Thanks