title: Spring Integration 4.1.6 How to check if custom header property is on message and if not add it
body: <p>I'm working wiht Spring Integration 4.1.6 jms message flow with two queues, main queue and exception queue. Read message from main queue, process it, if process is no success, push message to exception queue. I have poller which reads messages from exception queue and put back on main queue. I need this process conditional, where if message is moved from exception queue to main queue, say, 3 times then ignore message. To do this, I'm planning to add property into message header 'Retry_Count' and check this while pushing message from error queue to main queue or discard message.
  1. How to check if 'Retry_Count' property is on message?
  2. If 'Retry_Count' property is not on message, then add with initial count, say 1 and route to main queue
  3. If 'Retry_Count' property is on message, then check if retry count is less or equal to max retry number, 
  4. If 'Retry_Count' property value is less than max count, then increment count and route to main queue.
  5. If 'Retry_Count' property value is equal to max count, then route to discard queue.</p>
  
  <p>Note poller configuration is working by reading message from exception queue and route to main queue.</p>