class FileWriterQueueListener implements MessageListener {

    @Override
    public void onMessage(final Message message) {
        if (message instanceof ObjectMessage) {
            try {
                WilmaHttpEntity wilmaHttpEntity = getWilmaHttpEntityFromMessage(message);
                writeFile(message, wilmaHttpEntity);
            } catch (JMSException e) {
                throw new RuntimeException(e);
            }
        } else {
            throw new IllegalArgumentException("Message must be of type ObjectMessage");
        }
    }

}