Reputation: 12225
I am using Spring-integration
for listening to queues, and am now faced with a quite silly bug. It turns out that the name of a message paramter was misspelled, leading to runtime errors. To fix it, I have to rebuild the java-class, since the name of the message attribute is a hardcoded String
. I would like to resolve such errors easier in the future, by making the name of the message attributes configurable through a properties
-file, but I can't seem to find a way to do it. Is it at all possible?
public void someListenerMethod(@Header("someAttribute")
final Long someAttribute) {
I would here like to make the parameter to @Header
configurable..
Upvotes: 1
Views: 101
Reputation: 12225
I'll answer myself as I found one way of doing this (although I'm not sure it's optimal..)
@Value("${my.header.property.name}")
private String myHeaderPropertyName;
public void someListenerMethod(@Headers
final Map<String, Object> headerAttributes) {
final Long myHeaderAttribute = (Long) headerAttributes.get(myHeaderPropertyName));
Upvotes: 1