Point of clarification, the templated URL would itself be part of the coordinate Map, not a descriptor on the service so users would have total freedom there to send different variations with each record depending on their needs per record being enriched.
On Sat, Jun 2, 2018 at 8:55 PM Mike Thomsen <[email protected]> wrote: > Ok. That makes sense. The idea was that the RestLookupService would > provide a templated URL option so you could specify roughly this as an > example: > > GET "https://something.com:${port}/service/${username}/something/${related > }" > > And have the EL engine take the Map and fill in the blanks. > > On Sat, Jun 2, 2018 at 6:53 PM Matt Burgess <[email protected]> wrote: > >> Mike, >> >> IIRC the "top-level" EL evaluator will go through a string finding EL >> constructs and pass them into Query I think. Also ReplaceText (for >> some reason) is the only place I know of where you can quote something >> and (if EL is present), the result is treated as a string literal. >> Otherwise in NiFi Expression Language I believe a quoted construct on >> its own is an attribute to be evaluated. You might want the following: >> >> literal('${name}-${name:length()}') >> >> or if that doesn't work, it might be because the Query has to be a >> full EL construct so maybe you'd have to put the whole thing together >> yourself: >> >> Query.compile("${name}").evaluate(coordinates) + "-" + >> Query.compile("${name:length()}") >> >> I didn't try this out, and it's very possible my assumptions are not >> spot-on, so if these don't work let me know and I'll take a closer >> look. >> >> Regards, >> Matt >> >> >> >> >> On Sat, Jun 2, 2018 at 6:30 PM, Mike Thomsen <[email protected]> >> wrote: >> > I tried working with the EL package's Query object to try building >> > something like this: >> > >> > def evaluate(String query, Map coordinates) { >> > def compiled = Query.compile(query) >> > compiled.evaluate(coordinates) >> > } >> > >> > Which for [ name: "John Smith" ] and query '${name}-${name:length()}' I >> > expected would return a string with both bracketed operations executed. >> It >> > threw an exception saying unexpected token '-' at column 7. >> > >> > Am I missing something here? >> > >> > Thanks, >> > >> > Mike >> >
