@Override
    public void onMessage(Message message) {
        try {
            TextMessage textMsg = (TextMessage) message;
            String text = textMsg.getText();
            
            System.out.println(text);
            
            String mode[] = text.split("/");
            
            if(mode.length  < 2){
                System.out.println("Erro ao tentar interpretar mensagem.");
                return;
            }
            
            if(mode[0].equals("venda")){
                Operacao operation = Operacao.parseFromString(text.substring(6));
                
                showMessage(operation, "venda");
                
                if(operation != null){
                    if(!operation.isCompra()){
                        peer.checkOperation(operation);
                    }
                }
                
                return;
            }
            if(mode[0].equals("compra")){
                Operacao operation = Operacao.parseFromString(text.substring(7));
                
                showMessage(operation, "compra");
                
                if(operation != null){
                    if(operation.isCompra()){
                        peer.checkOperation(operation);
                    }
                }
                
                return;
            }
            
        } catch (JMSException ex) {
            ex.printStackTrace();
        }
    }