Esempio n. 1
0
    public static void Main(string [] args)
    {
        if (args.Length > 0)
        {
            url = args[0];
        }

        Console.Write("#\n# Request\n#\n# {0}\n#\n", EFTL.GetVersion());

        Hashtable options = new Hashtable();

        if (username != null)
        {
            options.Add(EFTL.PROPERTY_USERNAME, username);
        }

        if (password != null)
        {
            options.Add(EFTL.PROPERTY_PASSWORD, password);
        }

        try
        {
            // Asynchronously connect to the server.
            EFTL.Connect(url, options, new ConnectionListener());
        }
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
        }
    }
Esempio n. 2
0
    public KVRemove(String url, String username, String password)
    {
        Hashtable options = new Hashtable();

        if (username != null)
        {
            options.Add(EFTL.PROPERTY_USERNAME, username);
        }
        if (password != null)
        {
            options.Add(EFTL.PROPERTY_PASSWORD, password);
        }

        // Asynchronously connect to the eFTL server.
        EFTL.Connect(url, options, new ConnectionListener());
    }
Esempio n. 3
0
    public Subscriber(String url, String username, String password)
    {
        if (username != null)
        {
            options.Add(EFTL.PROPERTY_USERNAME, username);
        }

        if (password != null)
        {
            options.Add(EFTL.PROPERTY_PASSWORD, password);
        }

        // Asynchronously connect to the eFTL server.
        EFTL.Connect(url, options, new ConnectionListener());

        try {
            latch.Wait();
        } catch (Exception) {}
    }
Esempio n. 4
0
    public Publisher(String url, String username, String password)
    {
        if (username != null)
        {
            options.Add(EFTL.PROPERTY_USERNAME, username);
        }

        if (password != null)
        {
            options.Add(EFTL.PROPERTY_PASSWORD, password);
        }

        // Asynchronously connect to the eFTL server.
        EFTL.Connect(url, options, new ConnectionListener());

        try {
            latch.Wait();
        }
        catch (Exception e)
        {
            Console.WriteLine(e.Message);
        }
    }
Esempio n. 5
0
    public static void Main(string[] args)
    {
        for (int i = 0; i < args.Length; i++)
        {
            if (args[i].Equals("--username") || args[i].Equals("-u"))
            {
                if (i + 1 < args.Length && !args[i + 1].StartsWith("-"))
                {
                    username = args[++i];
                }
                else
                {
                    Usage();
                }
            }
            else if (args[i].Equals("--password") || args[i].Equals("-p"))
            {
                if (i + 1 < args.Length && !args[i + 1].StartsWith("-"))
                {
                    password = args[++i];
                }
                else
                {
                    Usage();
                }
            }
            else if (args[i].Equals("--map") || args[i].Equals("-m"))
            {
                if (i + 1 < args.Length && !args[i + 1].StartsWith("-"))
                {
                    name = args[++i];
                }
                else
                {
                    Usage();
                }
            }
            else if (args[i].Equals("--key") || args[i].Equals("-k"))
            {
                if (i + 1 < args.Length && !args[i + 1].StartsWith("-"))
                {
                    key = args[++i];
                }
                else
                {
                    Usage();
                }
            }
            else if (args[i].StartsWith("-"))
            {
                Usage();
            }
            else
            {
                url = args[i];
            }
        }

        Console.Write("#\n# KVRemove\n#\n# {0}\n#\n", EFTL.GetVersion());

        try {
            new KVRemove(url, username, password);
        } catch (Exception e) {
            Console.WriteLine(e.ToString());
        }
    }
Esempio n. 6
0
    public static void Main(string [] args)
    {
        for (int i = 0; i < args.Length; i++)
        {
            if (args[i].Equals("--username") || args[i].Equals("-u"))
            {
                if (i + 1 < args.Length && !args[i + 1].StartsWith("-"))
                {
                    username = args[++i];
                }
                else
                {
                    Usage();
                }
            }
            else if (args[i].Equals("--password") || args[i].Equals("-p"))
            {
                if (i + 1 < args.Length && !args[i + 1].StartsWith("-"))
                {
                    password = args[++i];
                }
                else
                {
                    Usage();
                }
            }
            else if (args[i].Equals("--destination") || args[i].Equals("-d"))
            {
                if (i + 1 < args.Length && !args[i + 1].StartsWith("-"))
                {
                    destination = args[++i];
                }
                else
                {
                    Usage();
                }
            }
            else if (args[i].Equals("--name") || args[i].Equals("-n"))
            {
                if (i + 1 < args.Length && !args[i + 1].StartsWith("-"))
                {
                    durable = args[++i];
                }
                else
                {
                    Usage();
                }
            }
            else if (args[i].Equals("--count") || args[i].Equals("-c"))
            {
                if (i + 1 < args.Length && !args[i + 1].StartsWith("-"))
                {
                    count = Int32.Parse(args[++i]);
                }
                else
                {
                    Usage();
                }
            }
            else if (args[i].StartsWith("-"))
            {
                Usage();
            }
            else
            {
                url = args[i];
            }
        }

        Console.Write("#\n# Subscriber\n#\n# {0}\n#\n", EFTL.GetVersion());

        try {
            Subscriber client = new Subscriber(url, username, password);

            try {
                if (client.IsConnected())
                {
                    latch.Reset();
                    client.Subscribe(destination, durable, count);
                }
            }
            catch (Exception) {}
            finally {
                client.Close();
            }
        }
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
        }
    }
Esempio n. 7
0
    public static void Main(string [] args)
    {
        for (int i = 0; i < args.Length; i++)
        {
            if (args[i].Equals("--username") || args[i].Equals("-u"))
            {
                if (i + 1 < args.Length && !args[i + 1].StartsWith("-"))
                {
                    username = args[++i];
                }
                else
                {
                    Usage();
                }
            }
            else if (args[i].Equals("--password") || args[i].Equals("-p"))
            {
                if (i + 1 < args.Length && !args[i + 1].StartsWith("-"))
                {
                    password = args[++i];
                }
                else
                {
                    Usage();
                }
            }
            else if (args[i].Equals("--count") || args[i].Equals("-c"))
            {
                if (i + 1 < args.Length && !args[i + 1].StartsWith("-"))
                {
                    count = Int32.Parse(args[++i]);
                }
                else
                {
                    Usage();
                }
            }
            else if (args[i].Equals("--rate") || args[i].Equals("-r"))
            {
                if (i + 1 < args.Length && !args[i + 1].StartsWith("-"))
                {
                    rate = Int32.Parse(args[++i]);
                }
                else
                {
                    Usage();
                }
            }
            else if (args[i].StartsWith("-"))
            {
                Usage();
            }
            else
            {
                url = args[i];
            }
        }

        Console.Write("#\n# Publisher\n#\n# {0}\n#\n", EFTL.GetVersion());

        try
        {
            Publisher client = new Publisher(url, username, password);

            try {
                if (client.IsConnected())
                {
                    client.Publish(count, rate);
                }
            } finally {
                client.Close();
            }
        }
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
        }
    }