Using beans and routines in a DSQL map
Use the java:call function to call global and custom routines in a
DSQL map.
This example only uses routines, but you can use the same method to call beans.
Before you begin
- You have created an input and an output structure. You can use the JSON samples below to create your structures.
About this task
In this example, you have an array of objects that each contain two strings. The untrimmed string has extra spaces that need to be removed with a global routine. For the ordered string, you will create a custom routine to reverse the order of the letters.
The input data looks like this:
[
{
"untrimmed": " extra spaces before and after ",
"ordered": "abcdefgh"
},
{
"untrimmed": " extra spaces before",
"ordered": "ijklmno"
},
{
"untrimmed": "extra spaces after ",
"ordered": "pqrstuvwxyz"
}
]
The output structure looks like this:
[
{
"trimmed": "",
"reversed": ""
}
]
Procedure
Results
[
{
"trimmed": "extra spaces before and after",
"reversed": "hgfedcba"
},
{
"trimmed": "extra spaces before",
"reversed": "onmlkji"
},
{
"trimmed": "extra spaces after",
"reversed": "zyxwvutsrqp"
}
]