Blog

Scott Steinbeck

March 28, 2016

Spread the word


Share your thoughts

Today we will be making a contact database that you can quickly and easily manage using ColdBox and Vue.js. We will be using bootstrap in our project to make it the UI look a little better but it is completely optional if you want to use this in your own project.

For this project I will be using CommandBox to generate all my files.

TL;DR: View the repo here

Lets Begin.

Step 1: You can skip this step if you already have a project set up. 

From CommandBox run:


coldbox create app name=CBVue skeleton=rest --installColdBox

This will give us a minimal project with a handlers\BaseHandler.cfc (needed to make our life easy when creating a REST API) and an handlers\Echo.cfc which is an example usage to get you started.

Now that we have our project started we need to tweak a few things.

First, since this is a template that is expecting to be setup for REST only, the Echo.cfc is set to be the default entry point. Since we want to create a view that accesses a REST API we need to point that to a view.

Step 2: Create you default Layout & View.


coldbox create layout Main

This is going to create our default layout. A layout is the outer template that you content will go inside.
The layout will be created in layouts/Main.cfm. Navigate to that folder and replace the content with this:


<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Coldbox & Vue.js</title>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
    <script type="text/javascript" src="http://cdn.jsdelivr.net/vue/1.0.18/vue.min.js"></script>
    <script type="text/javascript" src="https://rawgit.com/vuejs/vue-resource/master/dist/vue-resource.min.js"></script>
  </head>
  <body>
    <main>
	<cfoutput>#renderView()#</cfoutput>
    </main>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  </body>
</html>

This contain some boilerplate code to get our page setup and includes all of our libraries that will be needed. Again, the only libraries needed for this project are vue.js & vue-resource, everything else is just for UI.


coldbox create view main\index --helper

This will create 2 files: view/main/index.cfm, view/main/indexHelper.cfm.

index.cfm will contain the HTML table and form we will be interacting with. indexHelper.cfm (a file automatically included when we load index.cfm)  will contain all of our code for vue.js. The helper file is a connivence provided by ColdBox to help organize your code into separate files.

Now before we go too far, we need to change the default entry point to be our new index so that we will see the correct view. Navigate to config/ColdBox.cfc. In our settings we are going to change:

defaultEvent = "Main.index",

From this point is is time to start your server 


start --rewritesEnable --force

As a side note if your on CommandBox latest stable version you can also create a server.json file in the root of your project which will enable you to store all of your settings so when you want to start your server up in CommandBox you just type:


start

I have included my server.json in the repo if you want to take a look.

Step 3. Creating the REST API

We need a place to store our data so we will use a model, since we have been using CommandBox to generate our files we will continue to do so:


coldbox create model name=ContactService properties=contacts,lastID --accessors

This will create 2 files: models/ContactServices.cfc, tests/specs/unit/ContactServicesTest.cfc.

Navigate to our models/ContactServices.cfc, file and add this inside  your init function:


variables.contacts = {
	"1" : {"id": 1, "firstName": "Scott", 	"lastName": "Steinbeck", 	"phone": "661-555-5555",	"email": "scottsteinbeck@email.com"},
	"2" : {"id": 2, "firstName": "Scott", 	"lastName": "Coldwell", 	"phone": "661-555-5555",	"email": "scottcoldwell@email.com"},
	"3" : {"id": 3, "firstName": "Jon", 	"lastName": "Clausen", 		"phone": "661-555-5555",	"email": "johnclausen@email.com"},
	"4" : {"id": 4, "firstName": "Eric", 	"lastName": "Peterson", 	"phone": "661-555-5555",	"email": "ericpeterson@email.com"},
	"5" : {"id": 5, "firstName": "Andrew", 	"lastName": "Dixon", 		"phone": "661-555-5555",	"email": "andrewdixon@email.com"},
	"6" : {"id": 6, "firstName": "Gavin", 	"lastName": "Pickin", 		"phone": "661-555-5555",	"email": "gavinpickin@email.com"},
	"7" : {"id": 7, "firstName": "Brad", 	"lastName": "Wood", 		"phone": "661-555-5555",	"email": "bradwood@email.com"},
	"8" : {"id": 8, "firstName": "Luis", 	"lastName": "Majano", 		"phone": "661-555-5555",	"email": "luismajano@email.com"},
	"9" : {"id": 9, "firstName": "Jorge", 	"lastName": "Reyes", 		"phone": "661-555-5555",	"email": "jorgereyes@email.com"}
};

variables.lastID = 10;

This is just some default table rows to get us started seeing some data. Instead of adding a database into the mix i thought it would be easier to persist this in the singleton scope to make it simpler to walk though. This just makes it persist across refreshes and starts us at an increment number when we create new items. 

In case you are new to ColdBox you may be unfamiliar with the SINGLETON scope, it is one of the many scopes provided by WireBox to persist your data. For more detailed information check out: Wirebox Scopes

BTW: This model can easily be modified to use a database instead, and the best part is you can do it without ever making any changes to the front end :)

Now that our data is created lets create some helper methods for accessing & changing our data.

Below your init function paste the following code:


/**
* Get all contacts
*/
struct function getAll(){
	return variables.contacts;
}

/**
* save and return all contacts
* @contactID The id to save/update
* @data The data record
*/
struct function save( required contactID, required data ){
	// insert, move lastID
	if( arguments.contactID == 0 ){
		arguments.contactID = variables.lastID;
		arguments.data.id 	= variables.lastID;
		variables.lastID++;
	} 

	// Store data
	variables.contacts[ arguments.contactID ] = arguments.data;
	
	return variables.contacts;
}

/**
* Remove a contact
* @contactID The incoming ID
*/
struct function remove( required contactID ){
	structDelete( variables.contacts, arguments.contactID );
	return variables.contacts;
}

The methods should be pretty self explanatory, they allow us to keep the logic of data manipulation in the model so when we access it we can just simply call getAll(), save(), and remove(). This is extremely useful because all of your data logic is separated from the controller and in one place.

Since we already had a handler created handlers/Echo.cfc I decided to rename this handler to Contacts.cfc and changed its contents. Open up the file once you change the name and copy in the content below:


/**
* My RESTFul Contact Handler
*/
component extends="BaseHandler"{
    // Dependency Injection
    property name="contactService" inject="ContactService";

}

This is the base code that will extend our BaseHandler.cfc so we get all our RESTful helpers. Additionally, we inject our ContactService.cfc into our handler to use the helper methods we defined earlier.

The first API action is view which will list all of the contacts we have in our data:


/**
* List All Contacts
*/
any function view( event, rc, prc ){
	prc.response.setData( contactService.getAll() );
}

This will grab the data from the session and send it back as JSON

Our next action is save which, as it suggests, will save an existing row or add a new one.


/**
* Save A Contact
*/
any function save( event, rc, prc ){
	var requestBody = deserializeJSON( toString( getHTTPRequestData().content ) );
	var sContacts = contactService.save( requestBody.id, requestBody );
	prc.response.setData( sContacts );
}

You will notice something weird here event.getHTTPContent( json=true );, normally you would grab the data from the rc scope, but the vue-resource sends the data through the headers instead of the FORM or URL scope so we have to grab it from there.

Once we have the data posted we send the contact data to the ContactService so we can check if it has an existing id, if it is 0 we know its a new record, so we will create the new record, otherwise we will just update the existing data, then we send back the new data.

Lastly we will make it so you can delete a contact:


/**
* Delete An Existing Contact
*/
any function remove( event, rc, prc ){
	var sContacts = contactService.remove( rc.contactID );
	prc.response.setData( sContacts );
}

Now that our handler is done we need to add our routes for this handler so that we can map our functions to RESTful actions.

Open up your config/Routes.cfm file and add this line right above the route that says addRoute(pattern=":handler/:action?"); -- the order is important.


addRoute(pattern = 'contacts/:contactID?',handler = 'contacts',action = {GET = 'view', POST = 'save', PUT = 'save', DELETE = 'remove'});

Ok, now that we have our RESTful functions ready, we can start working on our front end.

Step 4. Creating our view

Open up your views/main/index.cfm that you created earlier. Inside you will copy in the html below


<div id="app" class="container">
	<div class="row">
		<div class="col-sm-4">
			<div class="panel panel-default">
			  <div class="panel-heading">
			    <strong>Add/Edit Contact</strong>
			  </div>
			  <div class="panel-body">
			    <div>
			      <div class="form-group"><input v-model="contactItem.firstName"    class="form-control" value="" placeholder="First Name"></div>
			      <div class="form-group"><input v-model="contactItem.lastName"     class="form-control" value="" placeholder="Last Name"></div>
			      <div class="form-group"><input v-model="contactItem.phone" 	class="form-control" value="" placeholder="Phone"></div>
			      <div class="form-group"><input v-model="contactItem.email" 	class="form-control" value="" placeholder="Email"></div>
			      <button class="btn btn-primary"  @click="saveContact()">Submit</button>
			      <button class="btn btn-warning"  @click="cancelSave()">Cancel</button>
			    </div>
			  </div>
			</div>
		</div>
		<div class="col-sm-8">
			<table class="table">
			  <thead>
			    <tr>
			      <th>First Name</th>
			      <th>Last Name</th>
			      <th>Phone</th>
			      <th>Email</th>
			      <th></th>
			    </tr>
			  </thead>
			  <tbody>
			    <tr v-for="contact in contacts">
			      <td>{{contact.firstName}}</td>
			      <td>{{contact.lastName}}</td>
			      <td>{{contact.phone}}</td>
			      <td>{{contact.email}}</td>
			      <td><button @click="loadContact(contact)"  type="button" class="btn btn-primary">Edit</button></td>
			      <td><button @click="deleteContact(contact)"  type="button" class="btn btn-danger">X</button></td>
			    </tr>
			  </tbody>
			</table>
		</div>
	</div>
</div>

This creates the html for our Contact Table & Contact Editor. You will notice some odd looking code if you are not familar with Vue.js or Angular JS:


v-model="contactItem.firstName"
v-for="contact in contacts"
@click="saveContact()"
{{contact.email}}

This is how Vue.js communicates with your code..


v-model="contactItem.firstName"

v-model, which is part of the form, binds together the form field and the Vue.js controller so they are aware of eachother.


v-for="contact in contacts"

v-for, is how Vue.js loops through a list of data, this can be used for any type of list.


@click="saveContact()"

@click, is basically equivalent to the onclick method, accept, this way the even is registered with the Vue.js controller so it can do something when you click it.


{{contact.email}}

{{contact.email}}, is known as handlebar syntax. This is how you define variables so Vue.js knows to replace them with that contact email for instance.

Step 4. Continued The Vue.js Controller

We will copy the following code into the views/main/indexHelper.cfm file. This file gets appended after our views/main/index.cfm.


<script>
$( document ).ready(function() {
new Vue({
  // Where the app will be instantiated on the page
  el: '#app',

  // Variables that you want it to have access to or start out with
  data: {
    contactItem: {
    	id:0,
    	firstName:'',
    	lastName:'',
    	phone:'',
    	email:''
    },
    contacts: []
  },
  
  // When this module is ready run this
  ready: function() {
    this.loadContacts();
  },

  // All the methods you want the view to have access to, basically an object of functions
  methods: {

    loadContacts: function() {
      var _this = this;
      // Get the list of contacts
      this.$http.get('/Contacts').then(function(result) {
      	// Update the list with the new data
        _this.$set('contacts', result.data.data);
      });
    },

    loadContact: function(contact) {
   	// Set the form with the contact row information
      	this.contactItem = contact;
    },

    saveContact: function() {
      var _this = this;
      // Save the new contact information
      this.$http.post('Contacts',_this.contactItem).then(function(result) {
      	// Reset the form to detault
      	_this.contactItem = {id:0,	firstName:'',	lastName:'',	phone:'',	email:''};
      	// Update the list with the new data
        return _this.$set('contacts', result.data.data);
      });
    },

    cancelSave: function(){
        // Reset the form to detault
        return this.contactItem = {id:0,	firstName:'',	lastName:'',	phone:'',	email:''};
    },
 
    deleteContact: function(contact) {
      var _this = this;
      //Delete the contact
      this.$http.delete('/Contacts/' + contact.id).then(function(result) {
      	// Update the list with the new data
        _this.$set('contacts', result.data.data);
      });
    }
  }
});
});
</script>

Lastly we have the controller. This is where all the magic happens.....


el: '#app',

Tells Vue that all of our logic will be nested within the <div id="app"></div>


  data: {
    contactItem: {
    	id:0,
    	firstName:'',
    	lastName:'',
    	phone:'',
    	email:''
    },
    contacts: []
  },

data is a struct of information it is pulling from, here we are providing defaults but you can also populate the data statically and it will use that information.


  // When this module is ready run this
  ready: function() {
    this.loadContacts();
  },

    loadContacts: function() {
      var _this = this;
      // Get the list of contacts
      this.$http.get('/Contacts').then(function(result) {
      	// Update the list with the new data
        _this.$set('contacts', result.data.data);
      });
    },

ready is fired once the Vue Component is loaded. What we are doing here is calling the ajax function that will load our table with data from our ColdBox RESTful API.

 

Gotcha** - Vue only knows about nested data changes if you use its built in functions (.$set, .$delete) otherwise you will be scratching your head for a while

 


_this.$set('contacts', result.data.data);

Load Contact - will load in our contact data into the form for editing. Notice the this.contactItem is being set to contact.


    loadContact: function(contact) {
   	// Set the form with the contact row information
      	this.contactItem = contact;
    },

Here the entire row of data is being sent as an argument when you click on the Edit button.


 <td><button @click="loadContact(contact)"  type="button" class="btn btn-primary">Edit</button></td>

So we are setting the 


this.contactItem = contact;

Now in our code we have the form set up with:


v-model="contactItem.firstName"

which means as soon as the this.contactItem has updated data it is going to update the v-model that is connected to that data.

Once the data is populated in the form we can make edits to it and then click either the submit or the cancel button. The respective code is below.


    saveContact: function() {
      var _this = this;
      // Save the new contact information
      this.$http.post('Contacts',_this.contactItem).then(function(result) {
      	// Reset the form to detault
      	_this.contactItem = {id:0,	firstName:'',	lastName:'',	phone:'',	email:''};
      	// Update the list with the new data
        return _this.$set('contacts', result.data.data);
      });
    },

    cancelSave: function(){
        // Reset the form to detault
        return this.contactItem = {id:0,	firstName:'',	lastName:'',	phone:'',	email:''};
    },

Since the default data sends an id = 0 we can decide if we need to create a new item or edit an existing item.

Last on our list for the Vue Controller is the Delete. Basically here we are just sending back the id to our API with the delete verb and our API will take care of deleting the entry and returning our new data set back to us.


deleteContact: function(contact) {
  var _this = this;
  //Delete the contact
  this.$http.delete('/Contacts/' + contact.id).then(function(result) {
  	// Update the list with the new data
    _this.$set('contacts', result.data.data);
  });
}

So thats it. All you need is a few files (Most of which can be generated by CommandBox) and you have got yourself a fully functional contacts manager.

The Code: View the repo here

Add Your Comment

(3)

Jul 19, 2016 06:33:11 UTC

by Don Bellenger

This is VERY interesting. I have a direct need for this at work right now. I went through it, until All you need is a few files (Most of which can be generated by CommandBox) and you have got yourself a fully functional contacts manager.. In any event, what I have right now is not working. Is there any chance you could tweak/check the writeup to work with latest Command Box, and have step-by-step (i.e. steps in order) instructions for going from an empty directory to a fully functional contacts manager? Also, some commends seemed not to work, e.g. coldbox create view main\index --helper. Perhaps a useful addition would be to give a single command that would install a fully functional contacts manager from Github, using command box. Then I could examine the code, in light of the excellent tutorial you have written.

Thank you for all this work.

Oct 20, 2016 19:27:34 UTC

by Dave Merrill

Thanks for this, interested in exactly these two technologies.

But you skipped an inconvenient but about doing things like this for real, like with a db and queries. As I'm sure you know, CD's serializeJSON doesn't pristine output that, as far as I know, Vue can consume directly.

I've written a js tool to process cf's format on the client, but I'm not sure if that can be tied into vue-resource, which is my preference over bootstrap/jquery.

Any thoughts on how you'd approach that?

Nov 04, 2016 10:35:06 UTC

by Luis Majano

@Dave

You can convert your query to array of structs to make it easier.

Recent Entries

BoxLang Scheduled Tasks Just Got Clustered!

BoxLang Scheduled Tasks Just Got Clustered!

I’ve been heads-down on clustering support for BoxLang, and the first feature to ride on top of it is the task scheduler. If you run more than one BoxLang server, you can now mark a scheduled task as clustered and each occurrence of that task runs on one node instead of on every node at once.

Maria Jose Herrera
Maria Jose Herrera
December 04, 2026
BoxLang 1.20: Clustering Services, Symbolic Links, HTTP Retries and more

BoxLang 1.20: Clustering Services, Symbolic Links, HTTP Retries and more

BoxLang 1.20: Run Once, Across the Fleet

BoxLang 1.20: Clustering Services, clustered scheduled tasks, HTTP retry, live process control and symbolic links

Ortus Solutions today announces BoxLang 1.20.0, packed with tons of fixes, improvements turesand some compelling new features. Meet the BoxLang Clustering Services and clustered scheduled tasks, so your nightly job runs once across every node instead of once per node. Add built-in HTTP retry with withRetry(), live process output with cancellation, first-class symbolic links, faster object creation, tighter security and a long list of CFML compatibility fixes. 55 issues, one clear direction: run real production systems on BoxLang with confidence.

class {

	function configure() {
		scheduler.task( "nightly-report" )
			.call( () => createObject( "ReportService" ).build() )
			.everyDayAt( "02:00" )
			.setCluster( true )
	}

}

Deploy that same scheduler to ten servers. The report builds once. 🚀

BoxLang Clustering Services 🌐

Run the same application on many servers and the servers need to know about each other. Until now BoxLang left that to you: a database table here, a Redis key there, a "node 1 is special" flag everywhere.

BoxLang 1.20 makes it part of the runtime. BoxLang Clustering Services is a framework for building cluster-aware features, with a full API that is yours to use. It is not a scheduler setting. Scheduled tasks are simply the first feature we built on top of it, and your own code and modules get the same foundation.

BoxLang Clustering Services: a framework with identity, heartbeat, node attributes and a fleet view, sitting on a shared cache, with clustered scheduled tasks and your own features built on top

What every node gets

  • Node identity. Every node has an id, {hostname}-{pid} by default, or the nodeId you set when your platform gives you a stable pod or task name
  • Named clusters. Nodes with the same cluster.name see each other. Different names never do, so one shared cache can serve several clusters
  • Membership and heartbeat. Each node rewrites its own record in the shared cache every 5 seconds by default. A node that stops beating drops out of the fleet on its own after about three missed beats
  • Node attributes. An open struct on every node record. Any feature can add keys of any type, and the feature that adds them owns their meaning
  • A view of the fleet. A lazily refreshed snapshot of every node, with helpers to read one node, the peers, or a single attribute
  • Any shared store. Coordination goes through a BoxLang cache backed by a store every node can see, such as Redis, a JDBC store, or a FileSystemStore on a shared volume

A full API, not just tasks

The scheduler uses this API like anyone else would. It publishes a rolling measure of how busy each node is as the attribute scheduler.taskSeconds, and peers read it to share work by load. You can do the same for your own data in three ways.

Push. Hold the service and write to it whenever you like. The next heartbeat picks up whatever is there. Java integrators reach it with BoxRuntime.getInstance().getClusterService():

ClusterService cluster = BoxRuntime.getInstance().getClusterService();

cluster.setAttribute( "perf.cpu.load", 0.42 );
cluster.mergeAttributes( Struct.of( Key.of( "region" ), "us-east" ) );
cluster.removeAttribute( "perf.cpu.load" );

Contribute. Register a supplier and its struct is merged into the node's attributes before each record write. A contributor that throws is logged and skipped, so no contributor can make a node look dead:

cluster.addAttributeContributor( () -> Struct.of( Key.of( "queueDepth" ), queue.size() ) );

Announce. On every heartbeat BoxLang fires the onClusterNodeAttributes interception point before it writes the record. Listen for it from BoxLang and add your own keys:

// Interceptor: add this node's data when the announcement fires
function onClusterNodeAttributes( data ) {
	data.attributes[ "region" ] = "us-east"
}

Then read the fleet from any node:

  • getNodes() returns every known node, including this one, and getPeers() returns everyone else
  • getNode( nodeId ) returns one record, and getNodeAttribute( nodeId, path, default ) returns one value by dotted path
  • getNodeNavigator( nodeId ) wraps a record for chaining, and getClusterReport() gives a diagnostic view of the node id, cluster name, cache, mode, attributes and known nodes
Object load = cluster.getNodeAttribute( "web-2", "attributes.perf.cpu.load", 0.0 );

The peer view is lazy. Nothing polls on a timer, so a deployment where nothing asks for peers does no peer reads at all. And getNodeAttribute is forgiving by design: the default shapes the result, and attributes older than three heartbeats return your default, so one feature's bad value or a stale node cannot break another feature's read.

Built to stay small

  • It never decides anything. No leader election, no "who is busiest", no claim arbitration. The service publishes data and hands it back, and every judgment belongs to the feature built on top. That keeps it small and stops it from growing into a distributed consensus framework
  • Best effort coordination. The shared cache offers no atomic create, so features on top must tolerate a narrow window where two nodes act at once
  • One root in the cache. Everything lives under bxcluster:{cluster}:, and each feature owns its own segment beneath it
  • No cost when unused. A node that is not in a cluster does no coordination work

What is built on it

  • Clustered scheduled tasks ship in 1.20.0, and you will meet them next
  • Cache invalidation, distributed locking and per-node health aggregation are the design intent. The service is built so features like these can sit on it, and none of them ship on it in 1.20.0

Turn it on with a top-level cluster block in boxlang.json on every node, and point cacheName at a cache they can all reach. The bundled default cache is local to each JVM, so nodes sharing it never see each other. Use Redis, a JDBC store, or a FileSystemStore on a shared volume. At startup BoxLang writes, reads back and removes a test value to prove the cache works, so a misconfigured cache shows up immediately:

{
	"cluster": {
		"enabled": true,
		"cacheName": "bxcluster"
	},
	"scheduler": {
		"clusterMode": "balanced"
	},
	"caches": {
		"bxcluster": {
			"provider": "Redis",
			"properties": {
				"host": "redis.internal.example.com",
				"port": "6379"
			}
		}
	}
}

Clustered scheduled tasks (BL-2800)

The first feature built on Clustering Services. If you have ever deployed one codebase to several nodes, you know the problem: every node loads the same Scheduler.bx, so everyDayAt( "02:00" ) fires on every server. Nightly cleanups, billing runs, report generation and cache warm-ups all run N times. Teams have worked around it for years with database locks, sticky servers and "only run on node 1" flags.

Three nodes share a cache, claim each scheduled occurrence once, and one node runs it

Mark a task as clustered with setCluster( true ), or cluster="true" on bx:schedule, and each occurrence runs on exactly one node. You get:

  • Load-based sharing of occurrences across the fleet. eager mode (the default) uses a short random delay, and balanced mode lets nodes rank each other by published load so an idle node takes the job
  • Failover without double runs. A clustered task never re-runs an occurrence. A crashed run is recorded as abandoned and the next occurrence runs normally
  • Graceful shutdown with configurable grace periods
  • A full run history in scheduler.log
  • Overlap control. By default the next occurrence is skipped while the previous one is still running, or choose run to allow overlap
  • Familiar API. onOneServer() keeps working and now means setCluster( true )

Every node registers the exact same scheduler, unchanged. One honest note: claims go through a shared cache, which offers no atomic create, so in a very narrow window an occurrence can still run twice. Make clustered jobs idempotent. Opt individual tasks out when they must run everywhere:

class {

	function configure() {
		scheduler.task( "nightly-report" )
			.call( () => createObject( "ReportService" ).build() )
			.everyDayAt( "02:00" )
			.setCluster( true )

		// Needs to run on every node, for example to warm a local cache
		scheduler.task( "warm-local-cache" )
			.call( () => createObject( "CacheWarmer" ).run() )
			.every( 10, "minutes" )
			.setCluster( false )
	}

}

Prefer templates? bx:schedule takes the same controls through its cluster and overlap attributes.

Scheduling got more reliable all around while we were in there:

  • Reload from disk (BL-2519, BL-2520). bx:schedule action="reload" rebuilds a scheduler from the tasks file, and the new scheduler.reloadOnChange setting reloads tasks when the file changes
  • Late cron ticks no longer vanish. A tick queued behind other work now fires, and logs a warning with a thread-count hint when the executor is saturated
  • Constraints use the due time, so a late tick is not skipped by crossing midnight (BL-2838)
  • Executor sizing honors your config. It was always 10
  • Monthly tasks on the 31st now clamp to the last day of shorter months instead of running daily (BL-2698)

Stop writing retry loops: HTTP retry 🔁

Calls to other services fail for reasons that go away on their own: a rate limit, a busy gateway, a slow response. Until now every team wrote the same retry loop, with the same bugs. In 1.20 (BL-2841) bx:http and the http() BIF retry transient failures for you. Retry is off until you ask for it, so nothing changes for existing code.

HTTP retry in BoxLang: a 503 then a 429 with Retry-After, then success, with retryCount in the result

One call is enough to get started:

result = http( "https://api.example.com/data" ).withRetry( 3 ).send()

Need more control? Pass a struct and watch each attempt:

result = http( "https://api.example.com/data" )
	.withRetry( {
		times    : 5,
		delay    : 1,
		backoff  : "exponential",
		maxDelay : 30
	} )
	.onRetry( ( attempt, httpResult, waitSeconds ) => println( "Attempt #attempt# failed, waiting #waitSeconds#s" ) )
	.send()

println( "Succeeded after #result.retryCount# retries" )

What you get:

  • Sensible defaults. It retries on 408, 429, 502, 503 and 504. Timeouts count as 408 and connection failures as 502. Change the list with withRetryOn() or add your own rule with withRetryWhen()
  • Fixed or exponential backoff, with a maxDelay cap
  • Retry-After is honored. A wait in seconds or an HTTP date replaces the backoff. If it is longer than retryMaxDelay, BoxLang stops retrying and returns that response
  • Final result only. onError, onComplete and throwOnError apply to the last attempt, and the result struct gains retryCount
  • Streams are safe. A request is never retried once a chunk callback has fired
  • Tags too. bx:http takes retry, retryDelay, retryOn, retryBackoff, retryMaxDelay, retryWhen and onRetry

Live process output and cancellation ⏯️

systemExecute() could already handle timeouts, working directories, environment overrides and output capture. BL-2809 covers the interactive case. Stream every line as it arrives, merge stderr into one live log, and cancel a runaway process cleanly.

jobId = createUUID()
application.jobs[ jobId ] = { cancelRequested : false }

result = systemExecute(
	name        = "ffmpeg",
	arguments   = [ "-i", "input.mp4", "output.mp4" ],
	mergeErrors = true,
	onLine      = ( line, stream ) => println( line ),
	isCancelled = () => application.jobs[ jobId ].cancelRequested
)

if ( result.cancelled ) {
	println( "Stopped by the user after: #result.output#" )
}

isCancelled() is polled while the process runs. When it returns true, BoxLang stops the process and everything it started, closes the streams and hands back what was captured so far. A cancellation is its own outcome: it is not a timeout and it is not a failed exit. Nothing changes for existing calls unless you opt in.

Blue/green style deploys, shared asset folders and current -> releases/v2 layouts all live on symbolic links. BoxLang 1.20 (BL-2820) brings native support:

A current symlink pointing at releases v2, and safe recursive delete that removes the link but never the target

base = getTempDirectory() & "deploy"
directoryCreate( base & "/releases/v2" )

fileCreateSymlink( base & "/current", "releases/v2" )

println( fileIsSymlink( base & "/current" ) )    // true
println( fileReadSymlink( base & "/current" ) )  // releases/v2

fileInfo() and getFileInfo() now report isLink and linkTarget, and directoryList() returns the same columns. directoryList(), directoryCopy(), directoryDelete() and bx:directory gain a followLinks argument that defaults to false.

That default is a security decision too (BL-2818). directoryDelete( path, true ) used to follow links and empty the folders they pointed to. Not anymore:

// Safe: the link is removed, the shared folder is untouched
directoryDelete( build, true )

// Opt in: the shared folder is emptied too
directoryDelete( build, true, true )

Even with followLinks=true, a link that leads back into the folder being deleted is removed as a link, so cycles can never loop or delete the folder you are standing in.

Our commitments, in this release 🤝

BoxLang is the software productivity platform for building, modernizing and running applications. 1.20 shows what that promise means in practice.

  • Drop-in for CFML. Your Adobe ColdFusion and Lucee code runs with no code changes through the bx-compat-cfml module. 1.20 keeps closing gaps: cfimport with taglib and prefix loads a directory of custom tags (BL-2722), cfzip action="list" returns a query (BL-2811), getPageContext().getRequest() returns the real servlet request (BL-2812), ImageRotate() matches Lucee and Adobe argument order (BL-2825), and serializeJSON( qry["col"] ) works as it does on Adobe (BL-2793)
  • Security first. A URL or form parameter named session, application, client or cffile can no longer replace that scope (BL-2802). External mappings are enforced for remote class requests and the root mapping (BL-2803, BL-2817). Recursive deletes no longer follow symbolic links (BL-2818)
  • Fast, and staying fast. Class lookup is now a single hash lookup, so new and createObject() no longer slow down as your application accumulates classes (BL-2805, BL-2798)
  • Resilient by default. Transient HTTP failures, late cron ticks, crashed cluster nodes and cancelled processes are now handled by the platform, so you stop hand-rolling the same safety nets in every project
  • Free and open. The BoxLang core is Apache 2.0. BoxLang+ is not priced by CPU cores, RAM, nodes or traffic, developer machines never count, and every BoxLang+ module includes a 60 day free trial. Estimate your own cost with the BoxLang calculator
  • Correctness you can trust. finally now runs when break or continue leaves a try (BL-2804), 19-digit integer literals compile (BL-2826), and queries over 1,048,576 rows no longer lose rows (BL-2717)

Moving to BoxLang? Meet the Migration Assistant 🧭

Everything above is easier to enjoy once you are on BoxLang. So we built the easy button.

The BoxLang Migration Assistant is a free desktop app that checks, audits and runs your Adobe ColdFusion or Lucee application on BoxLang, then builds your migration plan. Point it at your app folder and it walks you through every step. Your code never leaves your computer, and nothing is committed for you.

The BoxLang Migration Assistant flow: choose app, compile check, compatibility audit, server settings, generate files, test, migration plan

  1. Choose your app. It detects the engine from server.json (for example adobe@2023 or lucee@5), counts source files, and finds git, box.json and any CFConfig file
  2. Compile check. Every .cfm and .cfc is parsed with the real BoxLang compiler, the same check as boxlang check. Failures come with the line, the surrounding code and a fix prompt for your own LLM
  3. Compatibility audit. The CFML Feature Audit runs across your whole app and returns a compatibility score, the modules you need, and every feature with no BoxLang equivalent, with files and lines
  4. Server settings. Point CommandBox at your CFConfig export so datasources, mail servers and mappings come along, or start from a generated .boxlang.json
  5. Generate files. Preview, then write server.json, box.json, MIGRATION.md, AGENTS.md and the BoxLang migration skills for your AI coding agent, to a new git branch, your app folder or a copy
  6. Test it. One click starts your app on BoxLang through CommandBox and tells you when it answers
  7. Your migration plan. A checklist with status, steps, acceptance criteria and effort sizes, a Jira CSV and GitHub issues, one AI prompt that fixes the open items in order, and a management report you can save as a PDF

It runs on macOS (Apple Silicon), Windows (x64 and ARM) and Linux (x64 and ARM), and ships with its own Java runtime and BoxLang server, so there is nothing else to install. Prefer the command line? The same tools are yours: boxlang check, the CFML Feature Audit and the CFML Transpiler.

# Syntax and compile check across your app
boxlang check

# Install the CFML compatibility module on a CommandBox server
install bx-compat-cfml

Proof at scale: the U.S. Small Business Administration 🏛️

Big migrations are won on trust, and trust comes from real production systems. The U.S. Small Business Administration (SBA) moved from Adobe ColdFusion to BoxLang in about five months, across more than four million lines of code.

SBA migrated from Adobe ColdFusion to BoxLang in about five months, over four million lines of code

Four million lines. Government scale. Production-critical environments. No ground-up rewrite, and no multi-year program that never lands. That is the BoxLang promise made real: keep your investment in the code you have, shed the licensing lock-in, and modernize on a timeline a project plan can actually hold.

[SBA QUOTE PLACEHOLDER: add an approved quote from the SBA team here, with name, title and permission to publish]

Your application is different from theirs, but the path is the same: audit, run, fix what the audit finds, and ship. The Migration Assistant gives you that path as a checklist on day one.

Upgrading to 1.20: read this first ⚠️

1.20 is a drop-in upgrade for most apps. A few changes deserve a look before you roll it out:

  • Clustered tasks require clustering (breaking). A clustered task on a node with cluster.enabled=false now fails to start instead of running on every node. Enable the cluster block, or set the task's cluster to false
  • Tasks inherit scheduler.clusterTasks. With clustering enabled it defaults to true, so unset tasks become clustered. Set cluster to false per task, or set scheduler.clusterTasks to false to make clustering opt-in
  • scheduler.cacheName is deprecated. Use cluster.cacheName
  • Struct.putIfAbsent (BL-2808) is atomic and returns the existing value when the key is present, not null. Check for null if you treated a non-null return as "inserted"
  • Scheduler executor size now follows the threads of the executor named by scheduler.executor. Set threads explicitly if you relied on 10
  • Symbolic links. directoryDelete( path, true ) removes links as links, and directoryCopy() copies links as links. Pass followLinks=true for the old behavior
  • systemExecute() results gain a cancelled key, which matters if you iterate over result keys
  • Launchers. BOX_PROCESS_PATH is replaced by BOXLANG_PROCESS_PATH
  • HTTP retry is opt in, so existing bx:http and http() calls behave exactly as before

The complete list is in the 1.20.0 release notes.

Get started

Download BoxLang 1.20.0 from boxlang.io, read the release notes, and if you are coming from Adobe ColdFusion or Lucee, start with the Migration Assistant.

Resources

Run it once. Run it everywhere. Run it on BoxLang.

Luis Majano
Luis Majano
December 04, 2026
Get Your CFML Upgrade Back on the 2027 Roadmap

Get Your CFML Upgrade Back on the 2027 Roadmap

That ColdFusion or Lucee upgrade keeps slipping, and the same production issues keep taking time out of your sprint. See how Ortus Consulting and Professional Support can help you make room for both.

Maria Jose Herrera
Maria Jose Herrera
December 03, 2026