class HerdJmsMessageListener {

    @JmsListener(id = HerdJmsDestinationResolver.SQS_DESTINATION_HERD_INCOMING,
        containerFactory = "jmsListenerContainerFactory", destination = HerdJmsDestinationResolver.SQS_DESTINATION_HERD_INCOMING)
    public void processMessage(String payload, @Headers Map<Object, Object> allHeaders)
    {
        LOGGER.info("JMS message received from the queue. jmsQueueName=\"{}\" jmsMessageHeaders=\"{}\" jmsMessagePayload={}",
            HerdJmsDestinationResolver.SQS_DESTINATION_HERD_INCOMING, allHeaders, payload);

        // Process the message as S3 notification.
        boolean messageProcessed = processS3Notification(payload);

        if (!messageProcessed)
        {
            // The message was not processed, log the error.
            LOGGER.error("Failed to process message from the JMS queue. jmsQueueName=\"{}\" jmsMessagePayload={}",
                HerdJmsDestinationResolver.SQS_DESTINATION_HERD_INCOMING, payload);
        }
    }

}