You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Wilken Marci J <MA...@dhsoha.state.or.us.INVALID> on 2021/09/16 00:29:40 UTC

simple("${header.LoggingLevel}").evaluate(,String.class)

I am attempting to create a re-usable route for SQL errors. Based upon the SQLErrorLevel I want to write an Error, Warning, or Info message out.  I can set the LoggingLevel in the Header but I have figured out anyway to get it back out and use it. The closes I've come is simple("${header.LoggingLevel}").evaluate( <what can I put here>", String.class)) but I can't figure out how to get it to use the current exchange.

.choice()
	.when().simple("${header.SQLErrorLevel} =~ 'info'")
		.setHeader("LoggingLevel").simple("${type:org.apache.camel.LoggingLevel.INFO}")
	.endChoice()
	.when().simple("${header.SQLErrorLevel} =~ 'warn'")
		.setHeader("LoggingLevel").simple("${type:org.apache.camel.LoggingLevel.WARN}")
	.endChoice()
	.otherwise()
		.setHeader("LoggingLevel").simple("${type:org.apache.camel.LoggingLevel.ERROR}")
	.endChoice()
.end()	
  
.log(LoggingLevel.valueOf(simple("${header.LoggingLevel}").evaluate( <what can I put here>", String.class)),"* --> SQLErrorNumber: ${header.SQLErrorNumber}")

Regards-
Marci Wilken
She/Her/Hers