returning data via the interceptor

I have a function that is not rendered , and calls an interceptor, which executes a cfhttp call and gets a result

i am wondering how i can return data the interceptor has collected

my interceptor

`



var prc = event.getCollection( private = true ); var entityData = getmodel("entity").ESselect(id_number=interceptData.newEntity.id_number);

var esUrl = getSetting(‘elasticsearchUrl’)&’/’&index&’/’&type&’/’&APImethod;

`

my handler
`

function newEntity(event, rc, prc){
event.norender();
rc.interceptorResults = announceInterception(‘IncrementalIndex’, prc);
persistVariables(’‘interceptorResults’);
setNextEvent(“elastic/index”);

} ;
`

I expected the interceptorResults request collection item to have values, but none ever get passed. It DOES however execute correctly

Interceptor Asynchronicity

http://wiki.coldbox.org/wiki/WhatsNew:3.6.0.cfm

Getting results from interceptors can be done in two ways.

First of all, you have to note that when working with interceptors you move to event-driven programming land. Meaning the RPC approach is gone, there is no execute->get result paradigm anymore. Everything is events just like in JS in the browser.

  1. If the interceptors are ran synchronously then they can use the RC or PRC to drop their results there, so they can be picked up later.
  2. The interceptor can announce yet another event like “onResultsForThis” and then another interceptor can process the return.

Thoughts

signature0.jpg

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

Ok, forgive me as i am trying my best to learn, in the example i gave, am i calling the interceptor synchronously? as i was putting the results in the private collection, i was thinking it would return