How to store a Java Map<String, String> Type in a Pega property
Hi All,
I want to store a Map<String, String> into a Pega property.
Can anyone provide me with an example?
What should the property type be? Java Object?
And how to set the value?
Background
We need to send a message out via another system, that is build in Java. We communicate via a axual-stream and we need to produce a message according to this format:
Hi All,
I want to store a Map<String, String> into a Pega property.
Can anyone provide me with an example?
What should the property type be? Java Object?
And how to set the value?
Background
We need to send a message out via another system, that is build in Java. We communicate via a axual-stream and we need to produce a message according to this format:
{
"type": "record",
"name": "OutboundMessage",
"fields": [{
"name": "timestamp",
"type": "long"
}{
"name": "messageType",
"type": {
"type": "string",
"avro.java.string": "String"
}
},
{
"name": "params",
"type": {
"type": "map",
"values": {
"type": "string",
"avro.java.string": "String"
},
"avro.java.string": "String"
}
}]
}
The timestamp & messageType are not the issue.
But in params, the consumer expects { "param1" : "Some value", "param2" : "some other value" }
If I try to store that, the serialization gives an error, because the value becomes:
"{ \"param1\" : \"Some value\", \"param2\" : \"some other value\" }"
Hopefully someone can help out by telling me what the property type should be, and how to store the values in there.
Thanks!
I solved it like this:
Create a single Page with name 'params'
on that page, create string properties param1 and param2
Set the needed values into those properties.
Then it serializes into the same format as the recipient is expecting :)