Whatever message this page gives is out now! Go check it out!

thenAccept

Last update:
May 18, 2026
After this Future completes normally, runs a consuming callback on the completing thread with the result value.

Description

thenAccept is an instance method on a CFML Future. When the prior stage completes successfully, your action runs on the completing thread. The action receives the result and performs a side effect; it does not return a replacement value to the pipeline. A new Future is returned for further chaining.
This is the synchronous counterpart to thenAcceptAsync.

Returns

A new Future.

Category

Asynchronous programming

Function syntax

future.thenAccept(action)

Parameters

ParameterDescription
actionRequired. A function that accepts this stage’s result and performs work (void semantics).

Example

Capture the result in a side effect, then continue the chain.

<cfscript>
    future = runAsync(function() { return "test"; });
    future.thenAccept(function(x) { variables.consumed = x; }).get();
    writeOutput(variables.consumed); // test
</cfscript>
      

See also

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page