Blog

ColdBox 7.2.0 Released

Luis Majano November 20, 2023

Spread the word

Luis Majano

November 20, 2023

Spread the word


Share your thoughts

The release of ColdBox 7.2 introduces several significant enhancements for CFML developers and the ColdBox EcoSystem. A new SchemaInfo Helper offers convenient methods for handling database schema-related tasks, such as checking table and column existence, retrieving database information, and managing text and date-time column types. The Async allApply() now supports error handling with an optional errorHandler argument, allowing developers to log or react to exceptions during asynchronous operations.

Scheduled Task Groups provide a new way to categorize tasks, aiding in organization and management. Additionally, the release introduces the everySecond() period shortcut for tasks, an optional ColdBox class for handling task results, and updates to the DateTimeHelper with various new methods for improved date and time handling. WireBox now features an AOP Auto Mixer for automatic aspect detection, while CacheBox and LogBox receive Struct Literal Config updates for simplified configuration. These enhancements collectively contribute to a more robust and developer-friendly ColdBox platform.

You can read the in-depth release notes here: https://coldbox.ortusbooks.com/readme/release-history/whats-new-with-7.2.0

Update

The best way to update is using CommandBox:

box update coldbox

That's it! You are up to date now!

Major Highlights

ColdBox 7.2 introduces several new features that expand the capabilities of the framework and facilitate better development practices:

SchemaInfo Helper

A new helper has been born that assists you with dealing with Database Schema-related methods that are very common and core to ColdBox and supporting modules. This will grow as needed and be decoupled to its own module later.

  • hasTable()
  • hasColumn()
  • getDatabaseInfo()
  • getTextColumnType()
  • getDateTimeColumnType()
  • getQueryParamDateTimeType()

Async allApply() error handlers

The allApply() is great when dealing with async operations on arrays or collections of objects. However, if something blows up, it would blow up with no way for you to log in or know what happened. However, now you can pass an errorHandler argument which is a UDF/closure that will be attached to the onException() method of the future object. This way, you can react, log, or recover.

results = asyncManager.newFuture().allApply(
	items : data,
	fn : ( record ) => {
		var thisItem = new tests.tmp.User();
		thisItem.injectState = variables.injectState;

		// Inject Both States
		thisItem.injectState( protoTypeState );
		thisItem.injectState( record );

		return thisItem;
	},
	errorHandler : ( e ) => systemOutput( "error: #e.message#" )
)

Scheduled Task Groups

All scheduled tasks now have a group property so you can group your tasks. This is now available when creating tasks or setting them manually.

task( "email-notifications" )
  .setGroup( "admin" )
  .call( () => getInstance( "UserService" ).sendNotifications() )
  .everyDayAt( "13:00" )

You can then get the group using the getGroup() method or it will be added to all task metadata and stats.

New everySecond() period

A new period method shortcut: everySecond(). Very useful so you can fill up your logs with data.

task( "heartbeat" )
    .call( () => systemOutput( "data" ) )
    .everySecond()

Task Results Are Optionals

All task results, if any, are now stored in a ColdBox Optional. Which is a class that can deal with nulls gracefully and it's very fluent.

Task Get Last Result

New method to get the last result, if any, from a task via the getLastResult() method.

var result = task.getLastResult().orElse( "nada" )

DateTimeHelper Updates

Lot's of great new methods and goodies so you can deal with date and times and timezones Oh My!

  • now( [timezone] )
  • getSystemTimezoneAsString()
  • getLastBusinessDayOfTheMonth()
  • getFirstBusinessDayOfTheMonth()
  • dateTimeAdd()
  • timeUnitToSeconds()
  • validateTime()
  • getIsoTime()
  • toInstant()
  • toLocalDateTime()
  • parse()
  • toLocalDate()
  • getTimezone()
  • getSystemTimezone()
  • toJavaDate()
  • duration()
  • period()

WireBox Updates

AOP Auto Mixer

If in your binder you declare aspects or AOP bindings. Then WireBox will automatically detect it and load the AOP Mixer listener for you. You no longer have to declare it manually.

CacheBox Updates

New Struct Literal Config

You can now configure CacheBox by just passing a struct of CacheBox DSL config data.

new cachebox.system.cache.CacheFactory( {
	// LogBox Configuration file
	logBoxConfig      : "coldbox.system.cache.config.LogBox",
	// Scope registration, automatically register the cachebox factory instance on any CF scope
	// By default it registers itself on server scope
	scopeRegistration : {
		enabled : true,
		scope   : "application", // the cf scope you want
		key     : "cacheBox"
	},
	// The defaultCache has an implicit name of "default" which is a reserved cache name
	// It also has a default provider of cachebox which cannot be changed.
	// All timeouts are in minutes
	// Please note that each object store could have more configuration properties
	defaultCache : {
		objectDefaultTimeout           : 120,
		objectDefaultLastAccessTimeout : 30,
		useLastAccessTimeouts          : true,
		reapFrequency                  : 2,
		freeMemoryPercentageThreshold  : 0,
		evictionPolicy                 : "LRU",
		evictCount                     : 1,
		maxObjects                     : 300,
		objectStore                    : "ConcurrentSoftReferenceStore",
		// This switches the internal provider from normal cacheBox to coldbox enabled cachebox
		coldboxEnabled                 : false
	}
} );

LogBox Updates

New Struct Literal Config

You can now configure LogBox by just passing a struct of LogBox DSL config data.

var logBox = new logbox.system.logging.LogBox(
   {
	appenders : { myConsoleLiteral : { class : "ConsoleAppender" } },
	root      : { levelmax : "FATAL", appenders : "*" },
	info      : [ "hello.model", "yes.wow.wow" ],
	warn      : [ "hello.model", "yes.wow.wow" ],
	error     : [ "hello.model", "yes.wow.wow" ]
   }
);

Category Appender Excludes

When you declare categories in LogBox you usually choose the appenders to send messages to, but you could never exclude certain ones. Now you can use the exclude property:

root : { levelmax : "INFO", appenders : "*", exclude: "slackAppender" },
categories = {
    "coldbox.system" = { levelmax="WARN", appenders="*", exclude: "slackAppender" },
    "coldbox.system.web.services.HandlerService" = { levelMax="FATAL", appenders="*", exclude: "slackAppender" },
    "slackLogger" = { levelmax="WARN", appenders="slackAppender", exclude: "slackAppender" }
}

New Event Listeners

You now have two new event listeners that all LogBox appenders can listen to:

  • preProcessQueue( queue, context ) : Fires before a log queue is processed element by element.
  • postProcessQueue( queue, context ) : After the log queue has been processed and after the listener has slept.

processQueueElement receives the queue

The processQueueElement( data, context, queue ) now receives the entire queue as well as the queue third argument.

New Archive Layouts

If you use the RollingFileAppender the default layout format of the archive package was static and you could not change it. The default is:

#filename#-#yyy-mm-dd#-#hh-mm#-#archiveNumber#

Now you have the power. You can set a property for the appender called archiveLayout which maps to a closure/UDF that will build out the layout of the file name.


appenders : {
  files : {
      class : "RollingFileAppender",
      properties : {
          archiveLayout : variables.getDefaultArchiveLayout
      }
  }
}

function getDefaultArchiveLayout( required filename, required archiveCount ){
    return arguments.fileName &
    "-" &
    dateFormat( now(), "yyyy-mm-dd" ) &
    "-" &
    timeFormat( now(), "HH-mm" ) &
    "-#arguments.archiveCount + 1#";
}

Release Notes

Here you can find all the release notes: https://coldbox.ortusbooks.com/readme/release-history/whats-new-with-7.2.0

Conclusion

ColdBox 7.2 marks a noteworthy advancement for CFML developers, presenting robust new features, crucial bug fixes, and improvements that simplify development processes and enhance productivity. Whether you're an experienced ColdBox user or a newcomer, version 7.2 delivers a more dependable and efficient foundation for constructing web applications.

Don't forget to fork and start: https://github.com/coldbox/coldbox-platform

To explore the latest ColdBox release, visit their official website and peruse the updated documentation. Happy coding!

Add Your Comment

Recent Entries

Ortus Solutions Returns to CFCamp as Platinum Sponsor – Join Us to Redefine the Future with BoxLang!

Ortus Solutions Returns to CFCamp as Platinum Sponsor – Join Us to Redefine the Future with BoxLang!

We’re thrilled to announce that Ortus Solutions and BoxLang will once again join CFCamp as Platinum Sponsors for the 2025 edition. As passionate advocates of innovation in the CFML and modern JVM space, we’re proud to keep pushing boundaries—and this year is shaping up to be our biggest presence yet.

Day 1 Keynote by Luis Majano

CFCamp 2025 will kick off with a keynote delivered by none other than our CEO and BoxLang creator, Luis Majano. Join...

Cristobal Escobar
Cristobal Escobar
April 25, 2025
Must-See Into the Box 2025 Sessions for CommandBox Users!

Must-See Into the Box 2025 Sessions for CommandBox Users!

Power Up your CommandBox experience and practices at Into the Box 2025

Want to get hands-on with the new CommandBox features or learn how others are pushing it to the next level? These are the must-see sessions at ITB 2025 if you're a CommandBox user:

Maria Jose Herrera
Maria Jose Herrera
April 21, 2025
Must-See ITB 2025 Sessions for TestBox Users!

Must-See ITB 2025 Sessions for TestBox Users!

Are you a fan of TestBox or looking to level up your testing game in 2025? Whether you're just getting started with unit testing or you're already building advanced specs for ColdBox and BoxLang apps, Into the Box 2025 has an exciting lineup tailored just for you. Into the Box 2025 has an exciting lineup tailored just for you. With the recent launch of TestBox 6.3.0 we have amazing new tools, features and tips and tricks to get your testing experience to the next level, review our sessions and test like a pro efficiently and easy!

From hands-on testing strategies to BoxLang innovations, here are the sessions you won’t want to miss this May — and why they matter to you as a TestBox user.

Maria Jose Herrera
Maria Jose Herrera
April 17, 2025