Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Java Callout: handling of messageContext value objects?

Looking at the MessageContext object in my Java callout, and I see that the MessageContext interface specifies a `ctx.setVariable(String,Object)` method. I am curious how non-string objects are handled as flow variables.

For instance, if I have the following code:

JSONObject fooObject = doSomeWork();
messageContext.setVariable("foo",fooObject);

I see that this is allowed by the interface ... how is this flattened to be accessible by downstream policies?

My hope is that in future policies I could access the variable in a json-path-ish way as such:

{foo.the[2].path}

Alternatively, is it better to iterate through the object and flatten it into strings myself before persisting it to the messageContext to ensure that downstream policies can reference that data?

2 1 733
1 REPLY 1