Пример #1
0
        public override bool SetUp()
        {
            OK_TO_RUN = false;

            try
            {
                requestURL = definition.Attribute("requestURL").Value;
            }
            catch (Exception)
            {
                return(false);
            }
            if (definition.Name == "output" || definition.Name == "monitor")
            {
                try
                {
                    serviceQueue = new QEMSMQ(bufferQueueName);
                    OK_TO_RUN    = true;
                    _            = Task.Run(() => StartSimpleGetListener());

                    // Maintain the buffer queue to a limited length if configure
                    try
                    {
                        maxMessages = Int32.Parse(definition.Attribute("maxMessages").Value);
                        if (maxMessages != -1)
                        {
                            _ = Task.Run(() => MaintainQueue());
                        }
                    }
                    catch (Exception)
                    {
                        maxMessages = -1;
                    }
                    return(true);
                }
                catch (Exception ex)
                {
                    logger.Error(ex);
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        public QueueAbstract GetQueue(XElement ep, System.IProgress <QueueMonitorMessage> monitorMessageProgress)
        {
            string queueType = ep.Attribute("type").Value;

            QueueAbstract queue;

            switch (queueType)
            {
            case "MSMQ":
                queue = new QEMSMQ(ep, monitorMessageProgress);
                break;

            case "MQ":
                queue = new QEMQ(ep, monitorMessageProgress);
                break;

            case "HTTP":
                queue = new QEHTTP(ep, monitorMessageProgress);
                break;

            case "REST":
                queue = new QERest(ep, monitorMessageProgress);
                break;

            case "KAFKA":
                queue = new QEKafka(ep, monitorMessageProgress);
                break;

            case "RABBITDEFEX":
                queue = new QERabbitDefExchange(ep, monitorMessageProgress);
                break;

            case "FILE":
                queue = new QEFile(ep, monitorMessageProgress);
                break;

            case "SINK":
                queue = new QESink(ep, monitorMessageProgress);
                break;

            case "TCPSERVER":
            case "TCPCLIENT":
                queue = new QETCP(ep, monitorMessageProgress);
                break;

            case "TESTSOURCE":
                queue = new QESink(ep, monitorMessageProgress);
                break;

            case "SMTP":
                queue = new QESMTP(ep, monitorMessageProgress);
                break;

            case "MQTT":
                queue = new QEMQTT(ep, monitorMessageProgress);
                break;

            case "FTP":
                queue = new QEFTP(ep, monitorMessageProgress);
                break;

            default:
                queue = null;
                break;
            }

            return(queue);
        }
Пример #3
0
        public override bool SetUp()
        {
            OK_TO_RUN = false;

            try
            {
                bootStrapServers = definition.Attribute("connection").Value;
            }
            catch (Exception)
            {
                return(false);
            }
            try
            {
                key = definition.Attribute("key").Value;
            }
            catch (Exception)
            {
                key = null;
            }


            try
            {
                consumerGroup = definition.Attribute("consumerGroup").Value;
            }
            catch (Exception)
            {
                consumerGroup = "QueueExchange";
            }
            try
            {
                topic = definition.Attribute("topic").Value;
            }
            catch (Exception)
            {
                topic = "my_topic";
            }

            if (key == null)
            {
                key = topic;
            }

            try
            {
                // Create a service queue manager to write to and read from the buffer queue
                serviceQueue = new QEMSMQ(bufferQueueName);
            }
            catch (Exception)
            {
                bufferQueueName = null;
                if (definition.Name == "input")
                {
                    logger.Error($"A bufferQueueName must be correctly specified for a KAFKA interface");
                    return(false);
                }
            }

            OK_TO_RUN = true;

            //if (definition.Name == "input")
            //{
            //    _ = Task.Run(() => Run_Consume());
            //}

            return(true);
        }