Hi friends,
I kindly suggest a new feature: allow using scripts in field injections. Currently it allows literal values and expressions. I don’t want to use Input Parameters, as they pollute history with unnecessary transient data.
Motivation
I have a SendTask -> DelegateExpression -> ${camundaMailer}
CamundaMailer implementation:
public class CamundaMailerDelegate implements JavaDelegate {
@Autowired
private JavaMailSender sender;
@Override
public void execute(DelegateExecution delegateExecution) throws Exception {
MimeMessage message = sender.createMimeMessage();
MimeMessageHelper helper = new MimeMessageHelper(message);
helper.setTo(String.valueOf(delegateExecution.getVariable("to")));
helper.setText(String.valueOf(delegateExecution.getVariable("html")), true);
helper.setSubject(String.valueOf(delegateExecution.getVariable("subject")));
sender.send(message);
}
}
When html
variable exceeds 4000 characters History logger fails with exception:
org.h2.jdbc.JdbcSQLException: Value too long for column "TEXT_ VARCHAR(4000)": "STRINGDECODE('<!DOCTYPE html>....";
insert into ACT_HI_VARINST ( ... )
Possible workarounds
- I can
alter table act_hi_varinst alter text_ type text
on Postgresql and use Input Parameters, pros: this is fine, becausevarchar(4000)
is not ok anyway, cons: history pollution with non-essential data. - I can agree on some variable name prefix, e.g.
transient...
, so thattransientHtml
is not saved to history with a customHistoryLevel
, pros: relatively simple solution, cons: technical debt.