class DeviceRequestMessageListener implements MessageListener {

    @Override
    public void onMessage(final Message message) {

        ObjectMessage objectMessage = null;
        MessageMetadata messageMetadata = null;
        try {
            objectMessage = (ObjectMessage) message;
            messageMetadata = MessageMetadata.fromMessage(objectMessage);
        } catch (final Exception e) {
            LOGGER.error("UNRECOVERABLE ERROR, unable to read JMS message instance, giving up.", e);
            return;
        }

        try {
            LOGGER.info("Received message [correlationUid={}, messageType={}, messagePriority={}]",
                    messageMetadata.getCorrelationUid(), messageMetadata.getMessageType(),
                    messageMetadata.getMessagePriority());

            final MessageProcessor processor = this.messageProcessorMap.getMessageProcessor(objectMessage);

            processor.processMessage(objectMessage);

        } catch (final IllegalArgumentException | JMSException e) {
            LOGGER.error("Unexpected exception for message [correlationUid={}]", messageMetadata.getCorrelationUid(),
                    e);
            this.sendNotSupportedException(objectMessage, messageMetadata);
        }
    }

}