cbq
2.1.0
2.1.0
  • Home
  • What's New?
  • Getting Started
    • Installation
    • Walkthrough
  • Configuration
    • Module Settings
    • Config File
      • Queue Connection
      • Worker Pool
    • Providers
      • SyncProvider
      • ColdBoxAsyncProvider
      • DBProvider
  • Jobs
    • Defining a Job
    • Creating a Job
    • Dispatching a Job
    • Working a Job
    • Failed Jobs
    • Chained Jobs
    • Batched Jobs
  • cbq Model
  • Interceptors
  • Other
    • Contributing
    • Contributors
    • Prior Art
    • Dedication
Powered by GitBook
On this page
  • Interception Points
  • onCBQJobAdded
  • onCBQJobMarshalled
  • onCBQJobComplete
  • onCBQJobException
  • onCBQJobFailed
  • JobPattern Annotation

Interceptors

Interception Points

cbq announces the following interception points:

onCBQJobAdded

This is called when a Job is dispatched to a Queue.

onCBQJobMarshalled

This is called when a Job is pulled off the Queue to work.

onCBQJobComplete

This is called when a Job successfully finishes executing.

onCBQJobException

This is called when encountering an exception when handling a Job.

onCBQJobFailed

This is called when a Job is considered failed, after exhausting its maxAttempts.

JobPattern Annotation

component {

    function onCBQJobMarshalled( event, data ) jobPattern="SendWelcomeEmailJob" {
        // check if we've hit the email send limits for the month
    }

}

This annotation accepts a regex string to check against the Job full name:

component {

    function onCBQJobMarshalled( event, data ) jobPattern="^.*Email.*$" {
        // check if we've hit the email send limits for the month
    }

}

Jobs that do not match the interception point will send a notice to the debug log, if that is turned on for JobInterceptorRestriction.

Previouscbq ModelNextContributing

Last updated 1 year ago

To use the jobPattern annotation, you must have enabled the registerJobInterceptorRestrictionAspect setting in your .

Interceptors listening on the cbq interception points listed above can optionally restrict execution to certain Jobs using a jobPattern annotation (similar to the eventPattern annotation ).

module settings
in ColdBox