Blog

Luis Majano

April 20, 2021

Spread the word


Share your thoughts

 

Today we released ColdBox v6.4.0 but it feels more like a major release than a minor one. We are introducing tons of new features in this release, especially our anticipated: ColdBox Scheduled Tasks feature set.

update coldbox

# If you are using standalone libraries, then update those
update wirebox
update cachebox
update logbox

You can find our what's new document here: https://coldbox.ortusbooks.com/intro/release-history/whats-new-with-6.4.0. So let's explore some of the major features of this release and then on to our release notes.

Major Feaures

New view() & layout() Methods

We keep simplifying the ColdBox API and now you can use the view() and layout() methods instead of the renderView() or renderlayout() methods.

function data( event, rc, prc){
	
	.. data here
	
	
	return view( "data/myview" );
}


function pdf( event, rc, prc){
	
	.. data here
	
	
	return layout( layout: "pdf", view: "data/myview" );
}

Module Profiling

ColdBox will store the time it takes for modules to register and activate in their module configuration. These metrics can also be used by our new ColdBox Debugger project to profile and optimize your ColdBox applications.

Allow structs for QueryStrings

Every where in the ColdBox API you use a queryString you can now pass a struct for a nicer construct.

relocate( url : "/admin", queryString = { id : 2 } )

ColdBox Scheduled Tasks

Scheduled tasks have always been a point of soreness for many developers in ANY language. Especially choosing where to place them for execution: should it be cron? windows task scheduler? ColdFusion engine? Jenkins, Gitlab? and the list goes on and on.

Scheduled Tasks are NOT a ColdBox only feature. They are available in all of our STANDALONE libraries: CacheBox, LogBox and WireBox. THEY CAN BE USED IN ANY ANY, I REPEAT ANY, COLDFUSION (CFML) APPLICATION THAT IS NOT, NOT, NOT COLDBOX.

The ColdBox Scheduled Tasks offers a fresh, programmatic and human approach to scheduling tasks on your server and multi-server application. It allows you to define your tasks in a portable Scheduler we lovingly call the Scheduler.cfc which not only can be used to define your tasks, but also monitor all of their life-cycles and metrics of tasks. Since ColdBox is also hierarchical, it allows for every single ColdBox Module to also define a Scheduler and register their own tasks as well. This is a revolutionary approach to scheduling tasks in an HMVC application.

component {

	/**
	 * Configure the ColdBox Scheduler
	 */
	function configure() {
		/**
		 * --------------------------------------------------------------------------
		 * Configuration Methods
		 * --------------------------------------------------------------------------
		 * From here you can set global configurations for the scheduler
		 * - setTimezone( ) : change the timezone for ALL tasks
		 * - setExecutor( executorObject ) : change the executor if needed
		 * - setCacheName( "template" ) : Change the cachename for ALL tasks
		 * - setServerFixation( true ) : Set all tasks to run on one server
		 */
		


		/**
		 * --------------------------------------------------------------------------
		 * Register Scheduled Tasks
		 * --------------------------------------------------------------------------
		 * You register tasks with the task() method and get back a ColdBoxScheduledTask object
		 * that you can use to register your tasks configurations.
		 */
			
		task( "Clear Unregistered Users" )
			.call( () => getInstance( "UserService" ).clearRecentUsers() )
			.everyDayAt( "09:00" );
			
		task( "Hearbeat" )
			.call( () => runEvent( "main.heartbeat" ) )
			.every( 5, "minutes" )
			.onFailure( ( task, exception ) => {
				getInstance( "System" ).sendBadHeartbeat( exception );
			} );
	}

	/**
	 * Called before the scheduler is going to be shutdown
	 */
	function onShutdown(){
	}

	/**
	 * Called after the scheduler has registered all schedules
	 */
	function onStartup(){
	}

	/**
	 * Called whenever ANY task fails
	 *
	 * @task The task that got executed
	 * @exception The ColdFusion exception object
	 */
	function onAnyTaskError( required task, required exception ){
	}

	/**
	 * Called whenever ANY task succeeds
	 *
	 * @task The task that got executed
	 * @result The result (if any) that the task produced
	 */
	function onAnyTaskSuccess( required task, result ){
	}

	/**
	 * Called before ANY task runs
	 *
	 * @task The task about to be executed
	 */
	function beforeAnyTask( required task ){
	}

	/**
	 * Called after ANY task runs
	 *
	 * @task The task that got executed
	 * @result The result (if any) that the task produced
	 */
	function afterAnyTask( required task, result ){
	}

}

You can learn all about them in our two sections:

Release Notes

ColdBox HMVC

Bugs

  • COLDBOX-991 Fixes issues with Adobe losing App Context in Scheduled Tasks. You can now run scheduled tasks in Adobe with full app support.
  • COLDBOX-988 When running scheduled tasks in ACF loading of contexts produce a null pointer exception
  • COLDBOX-981 DataMarshaller no longer accepts 'row', 'column' or 'struct' as a valid argument.

Improvements

  • COLDBOX-998 Convert util to script and optimize
  • COLDBOX-989 Add more debugging when exceptions occur when loading/unloading thread contexts
  • COLDBOX-971 Implement caching strategy for application helper lookups into the default cache instead of the template cache.

New Features

  • COLDBOX-999 New SchedulerService that mointors and registers application scheduled tasks in an HMVC fashion
  • COLDBOX-997 Added out and error stream helpers to Scheduled Tasks for better debugging
  • COLDBOX-996 newTask() method on scheduled executor to replace nameless newSchedule
  • COLDBOX-995 New scheduler object to keep track and metrics of registered tasks
  • COLDBOX-994 New Scheduled Task with life-cycles and metrics
  • COLDBOX-993 New async.time package to deal with periods, durations, time offsets and so much more
  • COLDBOX-992 Added CFML Duration and Periods to async manager so task executions can be nicer and pin point accuracy
  • COLDBOX-990 Allow structs for query strings when doing relocations
  • COLDBOX-987 Encapsulate any type of exception in the REST Handler in a onAnyOtherException() action which can also be overidden by concrete handlers
  • COLDBOX-986 Add registration and activation timestamps to the a module configuration object for active profiling.
  • COLDBOX-985 Rename renderLayout() to just layout() and deprecate it for v7
  • COLDBOX-984 Rename renderView() to just view() and deprecate it for v7 {% endtab %}

WireBox

Bugs

  • WIREBOX-112 virtual inheritance causes double inits on objects that do not have a constructor and their parent does.
  • WIREBOX-95 onDIComplete() is called twice using virtual inheritance

New Features

  • WIREBOX-114 New coldbox dsl => coldbox:appScheduler which gives you the appScheduler@coldbox instance
  • WIREBOX-113 new injection dsl: wirebox:asyncManager

Add Your Comment

Recent Entries

BoxLang 1.0.0 Beta 23 Launched

BoxLang 1.0.0 Beta 23 Launched

The latest release of BoxLang, Beta 23, marks a significant step forward in our journey to create the ultimate dynamic language for the JVM. Packed with powerful new features, important bug fixes, and thoughtful optimizations, this update is designed to make your development experience smoother, faster, and more reliable, especially after now starting to take 100s of comments and bug reports from our community.

Luis Majano
Luis Majano
November 23, 2024
TestBox Latest Updates and News!

TestBox Latest Updates and News!

We’re thrilled to have launched the new TestBox website and TestBox 6.0! If you haven’t had a chance to explore yet, visit TestBox to discover updated documentation, powerful resources, and features that make testing more efficient than ever.

Maria Jose Herrera
Maria Jose Herrera
November 21, 2024
Is Your ColdFusion Application Ready for the Future?

Is Your ColdFusion Application Ready for the Future?

In a rapidly evolving digital world, maintaining performance, security, and scalability for ColdFusion applications is more challenging than ever. Whether you're using Lucee or Adobe ColdFusion, legacy systems can become a bottleneck for growth, innovation, and user satisfaction. The need to future-proof your ColdFusion applications has never been more critical.

But where do you start?


The Hidden Costs of an Outdated ColdFusion Application

As you...

Cristobal Escobar
Cristobal Escobar
November 21, 2024