I need to add a prefix to every message that goes out. I can do it using a method, but would like to just have the transformer handle it.
The problem is the message needs to be prefixed with control code characters that I can't really type out and then some additional text.
For example:
private final static char EOT = (char) 4;
private final static char STX = (char) 2;
private final static char ETX = (char) 3;
private final static String additionalText = " -0000 9305";
See: http://en.wikipedia.org/wiki/C0_and_C1_control_codes
Then the message would be prefixed with:
EOT + additionalText + ETX;
However, I can't find how to typecast the control codes in a SpEL expression used in the transformer:
<int:transformer
id="prefixAdder"
input-channel="initialMessage"
output-channel="prefixAdded"
expression="'#{(char) 4}' + ' -0000 9305' + '#{(char) 3}' + payload"/>