简体   繁体   English

ATG调度程序/队列管理器

[英]ATG scheduler/Queue Manager

ATG scheduler creates the scheduled job and executes it. ATG计划程序会创建并执行计划的作业。 If the job is in scheduler's thread other jobs have to wait. 如果作业在调度程序的线程中,则其他作业必须等待。 What I want to do is use ATG scheduler to create the job, pass to queue manager so that it executes one after other not stopping the scheduler all together. 我想做的是使用ATG调度程序创建作业,传递给队列管理器,以便它一个接一个地执行而不一起停止调度程序。 so I want to put a queue between scheduler creating the job and scheduler executing that same job. 所以我想在创建作业的调度程序和执行同一作业的调度程序之间放置一个队列。 Can this be done? 能做到吗? or there is a way where all my jobs will use same thread that's not scheduler's thread? 还是有一种方法,我的所有作业都将使用同一线程而不是调度程序的线程?

It sounds like you want to use a Dynamo Messaging System (aka PatchBay) queue in combination with a scheduler. 听起来好像您想将Dynamo消息系统(又名PatchBay)队列与调度程序结合使用。

Something along the lines of: 类似于以下内容:

  1. Scheduler runs and uses a MessageSource to put a jms messages on a queue for each job This ensures that the scheduler does not have to "wait" as it simply creates jms messages for each job. 调度程序运行并使用MessageSource将jms消息放入每个作业的队列中。 这确保了调度程序不必“等待”,因为它只需为每个作业创建jms消息即可。
  2. Create and configure a nucleus component JobMessageListener which implements the onMessage event and reads the jobs off the queue and delegates the work to another service. 创建并配置一个核心组件JobMessageListener ,该组件实现onMessage事件并从队列中读取作业,并将工作委托给另一个服务。 This ensures that the job fire up automatically and are processed in order as it is using a jms queue. 这样可以确保作业自动启动并按顺序使用jms队列进行处理。
  3. Create and configure a nucleus component, something along the lines of JobProcessorService which does the heavy lifting and processes the jobs. 创建并配置一个核心组件,类似于JobProcessorService这样的工作,它负责繁重的工作并处理作业。

You do not mention which version of ATG however for ATG 10.2 the instructions for achieving this can be found here . 您没有提到ATG的哪个版本,但是有关ATG 10.2的说明,请参见此处

You can control whether the job executes in its own thread or the schedulers thread if you are scheduling the job with the scheduler yourself via the schedulder.addScheduledJob(...) method. 如果要通过调度程序自己通过schedulder.addScheduledJob(...)方法调度作业,则可以控制该作业是在其自己的线程中执行还是在调度程序线程中执行。 The threadMethod property of ScheduledJob has three possible settings which are discussed in the link below. ScheduledJobthreadMethod属性具有三个可能的设置,下面的链接中对此进行了讨论。

ScheduledJob Thread Methods - Documentation Link ScheduledJob线程方法-文档链接

Basically, you have: 基本上,您有:

  • SCHEDULER_THREAD : Job runs using the schedulers thread. SCHEDULER_THREAD :作业使用调度程序线程运行。
  • SEPARATE_THREAD : Scheduler creates a new thread for each execution of the job and the job runs in that thread. SEPARATE_THREAD :调度程序为作业的每次执行创建一个新线程,该作业在该线程中运行。
  • REUSED_THREAD : Same as SEPERATE_METHOD except that the same thread is used across multiple runs of the job. REUSED_THREAD:SEPERATE_METHOD但使用相同的线程跨作业的多运行使用。

So, it sounds like you would want to use either SEPARATE_THREAD or REUSED_THREAD . 因此,听起来您想使用SEPARATE_THREADREUSED_THREAD

public void doStartService() throws ServiceException
{
    ScheduledJob job = new ScheduledJob("hello",
                                        "Prints Hello",
                                        getAbsoluteName(),
                                        getSchedule(),
                                        this,
                                        ScheduledJob.SEPARATE_THREAD);
    jobId = getScheduler().addScheduledJob(job);
}

If you're creating a job that extends from either SchedulableService or SingletonSchedulableService then you can configure the threadMethodString property of your component to have a value of either scheduler , separate , or reused and therefore avoid the custom coding shown above. 如果您正在创建从任一延伸的工作SchedulableServiceSingletonSchedulableService那么你就可以在配置threadMethodString您的组件的属性要么值schedulerseparatereused ,因此避免上面显示的自定义编码。 By default it is set to reused . 默认情况下,它设置为复reused

For example: 例如:

# /my/custom/MyScheduledJob
$class=my.custom.MyScheduledJob
$scope=global
threadMethodString=separate

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM