I am using Spring Integration filter to do a structural validation of the incoming payload and if the validation fails then i want to add some custom headers to the original message.
The filter code is below :
@Service("structureValidationFilter")
public class StructureValidationFilter implements MessageSelector {
@Override
public boolean accept(Message<?> message) {
    // TODO Auto-generated method stub
    boolean status=true;
    if(message.getPayload() instanceof CFKRequestBody) {
        CFKRequestBody body=(CFKRequestBody)message.getPayload();
        if(!body.getInitiatingPartyId().equalsIgnoreCase("BPKV")) {
            message = MutableMessageBuilder.fromMessage(message).
                    setHeader("BPKV_ERROR_CODE", "Ïnvalid Initiating part id").
                    setHeader("HTTP_STATUS", "400").build();
            return false;   
        }
    }
    return status;
}
}
But the headers are not populating in the Message. Not able to see the headers added in the next component. What am i doing wrong here.
 
     
    