Expand my Community achievements bar.

We are excited to introduce our latest innovation to enhance the Adobe Campaign user experience — the Adobe Campaign v8 Web User Interface!
SOLVED

AC6.1/7 JavaScript engine: what it is, what is can do?

Avatar

Level 3

Hi all,

So, we're doing some king of development with our AC installation. This "some kind" means: defining our own Forms, calling our own Schema's methods via SOAP on enter and leave and all that stuff.

So far so good, but the question came up: is JS engine in AC totally synchronous? As I see now, even HttpClientRequest and I/O (File and Memory Buffer methods) are synchronous and the js-api helpfile we've got from Support isn't describing everything AC has (great stuff like NL.toDebugString is missed totally).

The other question is: what version of JS/ECMA it is? I'm wondering because e.g. list comprehensions are impossible, but they were introduced in JS back in 2006, and 'let' operator seems to work at the same time (btw, is it actuall 'let' with block scope?).

In shorten, questions are:

1. Is there any event mechanism? Is there anything working in async?

2. What JS engine provided? Fully custom?

3. If no async at all, is only 1 thread running for everything? E.g. if 50 users will work with the same Form which calls number of Schema's methods via SOAP - soaprouter will place all calls in queue? Same for Workflows: if only 1 process is dedicated for all Workflows - there should be queue of running Workflows and only one activity running at any time (especially if they're also written in JS stored in the system and not coded into the core), no?

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 3

Yep, it's sometimes complicated to see what data is transferred between Workflow activities.

NL.toDebugString() can show you the XML context being outputed from some activities (this is really useful to catch records rejected by 'Update data').

The other thing I've discovered is a way to look into temporary SQL tables (these wkf_id_number ones)  which are created by Query-base activities (like Enrichment, Splits ets). This code:

     var tableName = application.getSchema(vars.targetSchema).root.SQLTable;

     var tableDesc = sqlSelect("tableDesc,@column_name:string,@data_type:string,@character_maximum_length:string","select column_name, data_type, character_maximum_length from INFORMATION_SCHEMA.COLUMNS where table_name = '" + tableName + "';");

     logInfo(tableDesc.toXMLString());

Can dump temporary table description if you're using postgres, so then you can manually access the data.

View solution in original post

4 Replies

Avatar

Level 10

Hi Andrey,

Very interesting questions about architecture, they should be better answered by Adobe Campaign team/architects.

But I will try to give some hints right now.

Regarding workflows, please have a look on worflows affinities:
Server side configurations

then you can choose the wfserver engine in the workflow property/Execution tab (Affinity listbox). for all the workflow, or if it is on a specific task, the Advanced Tab of the task and Affinity list box.

Please check also in the advanced parameters of a task, the behavior listbox, by default multi-tasking but you can force for priority/1 task only.

Regarding asynchronous tasks:

1. there is an example of non-blocking calls with callback function for SOAP call in SoapService method, in the JSAPI documentation. And see also SoapService.wait function.

2. I find something interesting in AC but quite recent builds, the pipeline process (using Apache Kafka). While it seems to being implemented for coupling Adobe Analytics and AC, perhaps it is valuable for local and on premises installation (I didn't had time to activate it yet on my On Premise machines).

How to use Marketing Cloud Triggers with Adobe Campaign

Please share your experiments in case of you find it useful in other cases.

Please may you explain what is NL.toDebugString intended for? Is it something like logInfo function?

Regards

Jean-Serge

Avatar

Level 3

Hi Jean-Serge,

This is pretty interesting: SOAP calls are async, but general HttpClientRequest - not.

And thanks for pipelines doc - we'll try it for sure when after updating our instances.

NL.toDebugString is defined in xtk:shared/nl.js file and acts like JSON.stringify() with some AC-specific additions.

I found it useful to examine data returned by some activities e.g. 'Update data' as with it you can simply dump to log the entire XML structure without accessing its fields (for instance, if you're not sure of their names).

Avatar

Level 10

Thank you Andrey, for the information about NL.toDebugString !

Because so far, it takes so much time to debug the context sometimes:

I used to do logInfo with JSON.Stringify or objects values writing in workflows...
I am dreaming of such debugging tool as in webApp Preview in Debug mode (seeing XML Context is very useful).

I will use your hint from now.

Avatar

Correct answer by
Level 3

Yep, it's sometimes complicated to see what data is transferred between Workflow activities.

NL.toDebugString() can show you the XML context being outputed from some activities (this is really useful to catch records rejected by 'Update data').

The other thing I've discovered is a way to look into temporary SQL tables (these wkf_id_number ones)  which are created by Query-base activities (like Enrichment, Splits ets). This code:

     var tableName = application.getSchema(vars.targetSchema).root.SQLTable;

     var tableDesc = sqlSelect("tableDesc,@column_name:string,@data_type:string,@character_maximum_length:string","select column_name, data_type, character_maximum_length from INFORMATION_SCHEMA.COLUMNS where table_name = '" + tableName + "';");

     logInfo(tableDesc.toXMLString());

Can dump temporary table description if you're using postgres, so then you can manually access the data.