public override IChannel OpenChannel(string uri, ChannelType type)
        {
            IChannel ch = null;

            if (type.Equals(ChannelType.BecsQueue))
            {
                ch = GetChannel(uri);
                if (ch == null)
                {
                    ch     = new BecsChannel(_outQueue, _inQueue);
                    ch.Uri = uri;
                    AddToChannels(uri, ch);
                }
            }
            return(ch);
        }
        private void OnInQueueReceiveCompleted(FecsBecsHeader header, string body)
        {
            if (_channelMgr != null)
            {
                string   uri     = header.ID;
                IChannel channel = _channelMgr.GetChannel(uri);
                if (channel == null)
                {
                    channel = _channelMgr.OpenChannel(uri, ChannelType.BecsQueue);
                    if (channel != null)
                    {
                        MessageProcessorManager.OnNewConnection(channel);
                    }
                }
                if (channel != null)
                {
                    BecsChannel   bc     = (BecsChannel)channel;
                    StringBuilder packet = new StringBuilder(256);
                    packet.AppendFormat(null, "<{0} {1}=\"{2}\" {3}=\"{4}\">{5}</{0}>",
                                        Tags.Packet, Tags.PacketSrcAttr, header.PacketInfo.SourceId,
                                        Tags.PacketDateAttr, Dtx.DtxToString(header.PacketInfo.Dtx), body);
                    string  xml         = packet.ToString();
                    ILogger localLogger = null;
                    try
                    {
                        Database   d        = null;
                        CmpUnitsDB cmpUnits = new CmpUnitsDB();
                        //d = DatabaseFactory.GetDatabase();
                        localLogger = DatabaseFactory.Logger;

                        if (localLogger != null)
                        {
                            localLogger.AddLog("[OnInQueueReceiveCompleted]: Updating ID: " + header.PacketInfo.SourceId + " IP :" + header.IP, LoggerSeverities.Debug);
                        }
                        if (Convert.ToInt32(header.PacketInfo.SourceId) != -1)
                        {
                            if (cmpUnits.UpdateIP(Convert.ToInt32(header.PacketInfo.SourceId), header.IP) != 1)
                            {
                                if (localLogger != null)
                                {
                                    localLogger.AddLog("[OnInQueueReceiveCompleted]: Error Updating IP", LoggerSeverities.Debug);
                                }
                            }
                            else
                            {
                                if (localLogger != null)
                                {
                                    localLogger.AddLog("[OnInQueueReceiveCompleted]: Update OK", LoggerSeverities.Debug);
                                }
                            }
                        }
                    }
                    catch
                    {
                        // Do not do nothing??
                        // Si tenemos un error en realizar un update de la ip
                        // no hacemos nada
                        if (localLogger != null)
                        {
                            localLogger.AddLog("[OnInQueueReceiveCompleted]: Error Updating IP", LoggerSeverities.Debug);
                        }
                    }
                    Interlocked.Increment(ref _packetId);
                    OPSTelegrama opsTel = OPSTelegramaFactory.CreateOPSTelegrama(_packetId, xml);
                    bc.ReceiveMessage(opsTel);
                }
            }
        }