public static void main(String[] args) {
        LOGGER.info("JMSChat creation process has been started with arguments: {}", args);
        if (args.length != 1) {
            LOGGER.error("Username is missing");
            System.exit(0);
        }

        JMSChat chat = null;
        try {
            chat = new JMSChat(Constants.DESTINATION_NAME_TOPIC);

            BufferedReader commandLine = new BufferedReader(new InputStreamReader(System.in));

            while(true) {
                try {
                    String msg = commandLine.readLine();
                    if ("exit".equalsIgnoreCase(msg)) {
                        chat.producer.closeConnection();
                        chat.consumer.closeConnection();
                        System.exit(0);
                    } else {
                        chat.producer.writeMessage(String.format("[%s]: %s", args[0], msg));
                    }
                } catch (IOException e) {
                    LOGGER.error("Exception has been caught during reading input stream", e);
                    throw e;
                } catch (JMSException e) {
                    LOGGER.error("Exception has been caught during JMS work", e);
                    throw e;
                }
            }
        } catch (Exception ex) {
            LOGGER.error("Exception has been caught", ex);
        } finally {
            if (chat != null) {
                if (chat.producer != null) {
                    chat.producer.closeConnection();
                }
                if (chat.consumer != null) {
                    chat.consumer.closeConnection();
                }
            }
        }
    }