.NET communication with Progress

I have a .NET communication with Progress that is done through a broker, agents that connect to the database, and I'm having problems because some agents are getting their connection stuck, and this is overloading the system, leaving it slow.

Is there any way to track these where these agents are getting stuck in order to solve this problem?

Sample method :

C#:
        public List<Pedido> ObterCotacoesAprovadasPorCompradorEstabelecimento(Comprador pComprador, RH.Model.Estabelecimento pEstabelecimento)
        {
            ns_scw.StrongTypesNS.dsProcessosAprovadosDataSet myDs = new ns_scw.StrongTypesNS.dsProcessosAprovadosDataSet();
            scw appObj = new scw(new InfraProgress("SCW").BuscaBroker(), "", "", "");
            appObj.scw_listar_cotacoes_aprovadas_MVC(pComprador.Id, pEstabelecimento.Id, out myDs);

            List<Pedido> myLista = null;
            if (myDs.Tables[0].Rows.Count > 0)
            {
                myLista = new List<Pedido>();
                foreach (System.Data.DataRow myLinha in myDs.Tables[0].Rows)
                {
                    Pedido myPedido = new Pedido()
                    {
                        Processo = new ProcessoRepository().ObterProcessoPorId(new Processo() { Id = int.Parse(myLinha["iProcesso"].ToString()) }),
                        Fornecedor = new FornecedorRepository().ObterFornecedorPorID(new Fornecedor() { Id = int.Parse(myLinha["iFornecedor"].ToString()) }),
                        Contato = myLinha["cContato"].ToString()
                    };
                    myPedido.Fornecedor.Cidade = myLinha["cCidade"].ToString();
                    Estado myEstado = new Estado() { Sigla = myLinha["cEstado"].ToString() };
                    myPedido.Fornecedor.Estado = myEstado;
                    myLista.Add(myPedido);
                }
            }
            appObj.Dispose();
            return myLista;
        }
 

Cringer

ProgressTalk.com Moderator
Staff member
How are you connecting to the Progress side? Something like ODBC? How do you know the agents are getting stuck?
 
I'm connecting via broker.

I know you're stuck in a consultation.

Follow the code I use.

Code:
def input parameter c-operacao as character.
def input parameter c-broker as character.
def output parameter c-status as character.

def var c-comando as char.
def var c-linha as char.
def var l-agentes as logical initial no.

def temp-table tt-broker
  field c-agenteid as character
  field c-status as character.

def dataset dsbrokers for tt-broker.
def output parameter dataset for dsbrokers.

case c-operacao:
  when 'C'
     then assign c-comando = 'c:\progress\openedge116\bin\asbman.bat -name ' + trim(c-broker) + ' -query > c:\temp\brkresult.txt'.
  when 'K'
     then assign c-comando = 'c:\progress\openedge116\bin\asbman.bat -name ' + trim(c-broker) + ' -k '.
  when 'S'
     then assign c-comando = 'c:\progress\openedge116\bin\asbman.bat -name ' + trim(c-broker) + ' -start '.
end.                           
                  
dos silent value(c-comando).

if c-operacao = 'C' then
do:
   input from c:\temp\brkresult.txt.
   repeat:
        import UNFORMATTED c-linha.
  
        if substr(c-linha,1,13) = 'Broker Status'
          then assign c-status = substr(c-linha,34,15).
          
        if l-agentes then
        do:
           if substr(c-linha,1,5) <> '     ' then
           do:
              create tt-broker.
              assign tt-broker.c-agenteid = substr(c-linha,1,5)
                     tt-broker.c-status = substr(c-linha,7,9).
           end.         
        end. 
        
        if substr(c-linha,1,3) = 'PID'
          then assign l-agentes = yes.
        
   end.
  
   input close.
   dos silent ('del c:\temp\brkresult.txt').
end.
 
Top