@Override
    public void onMessage(Message message) {
        int messageNumber = messageCounter.incrementAndGet();
        if (message instanceof TextMessage) {
            TextMessage textMessage = (TextMessage) message;
            try {
                logger.info("Receive message #" + messageNumber + ": " + textMessage.getText());
            } catch (JMSException e) {
                logger.log(Level.WARNING, "Exception reading message", e);
            }
        } else {
            logger.info("Receive message #" + messageNumber + ": " + message);
        }
    }