Example #1
0
    public long _2_0_2_AddJob_Async_TimeToLive_Wait_Dead(Disquuun disquuun)
    {
        WaitUntil("_2_0_2_AddJob_Async_TimeToLive_Wait_Dead", () => (disquuun.State() == Disquuun.ConnectionState.OPENED), 5);

        var queueId = Guid.NewGuid().ToString();

        var jobId = string.Empty;

        disquuun.AddJob(queueId, data_10, 0, "TTL", 1).Async(
            (command, result) =>
        {
            jobId = DisquuunDeserializer.AddJob(result);
        }
            );

        WaitUntil("_2_0_2_AddJob_Async_TimeToLive_Wait_Dead", () => !string.IsNullOrEmpty(jobId), 5);

        // wait 2 sec.
        Wait("_2_0_2_AddJob_Async_TimeToLive_Wait_Dead", 2);

        // get queue len.
        var len = DisquuunDeserializer.Qlen(disquuun.Qlen(queueId).DEPRICATED_Sync());

        Assert("_2_0_2_AddJob_Async_TimeToLive_Wait_Dead", len == 0, "not match, len:" + len);

        return(0);
    }
Example #2
0
    public long _1_0_2_AddJob_Sync_TimeToLive_Wait_Dead(Disquuun disquuun)
    {
        WaitUntil("_1_0_2_AddJob_Sync_TimeToLive_Wait_Dead", () => (disquuun.State() == Disquuun.ConnectionState.OPENED), 5);
        var w = new Stopwatch();

        w.Start();


        var queueId = Guid.NewGuid().ToString();

        var result = disquuun.AddJob(queueId, data_10, 0, "TTL", 1).DEPRICATED_Sync();
        var jobId  = DisquuunDeserializer.AddJob(result);

        WaitUntil("_1_0_2_AddJob_Sync_TimeToLive_Wait_Dead", () => !string.IsNullOrEmpty(jobId), 5);

        // wait 2 sec.
        Wait("_1_0_2_AddJob_Sync_TimeToLive_Wait_Dead", 2);

        // get queue len.
        var len = DisquuunDeserializer.Qlen(disquuun.Qlen(queueId).DEPRICATED_Sync());

        Assert("_1_0_2_AddJob_Sync_TimeToLive_Wait_Dead", len == 0, "not match, len:" + len);
        w.Stop();
        return(w.ElapsedMilliseconds);
    }
Example #3
0
    public long _2_8_Qlen_Async(Disquuun disquuun)
    {
        WaitUntil("_2_8_Qlen_Async", () => (disquuun.State() == Disquuun.ConnectionState.OPENED), 5);

        var queueId = Guid.NewGuid().ToString();
        var jobId   = DisquuunDeserializer.AddJob(
            disquuun.AddJob(queueId, data_10).DEPRICATED_Sync()
            );

        var w = new Stopwatch();

        w.Start();


        var qlen = 0;

        disquuun.Qlen(queueId).Async(
            (c, data) =>
        {
            qlen = DisquuunDeserializer.Qlen(data);
            w.Stop();
        }
            );
        WaitUntil("_2_8_Qlen_Async", () => (qlen == 1), 5);

        var result   = disquuun.FastAck(new string[] { jobId }).DEPRICATED_Sync();
        var ackCount = DisquuunDeserializer.FastAck(result);

        return(w.ElapsedMilliseconds);
    }
Example #4
0
    public long _2_0_4_AddJob_Async_Retry_0_And_TTL_1Sec(Disquuun disquuun)
    {
        WaitUntil("_2_0_4_AddJob_Async_Retry_0_And_TTL_1Sec", () => (disquuun.State() == Disquuun.ConnectionState.OPENED), 5);

        var queueId = Guid.NewGuid().ToString();

        var jobId = string.Empty;

        disquuun.AddJob(queueId, data_10, 0, "RETRY", 0, "TTL", 1).Async(
            (command, result) =>
        {
            jobId = DisquuunDeserializer.AddJob(result);
        }
            );

        WaitUntil("_2_0_4_AddJob_Async_Retry_0_And_TTL_1Sec", () => !string.IsNullOrEmpty(jobId), 5);

        DisquuunDeserializer.Qlen(disquuun.Qlen(queueId).DEPRICATED_Sync());

        // getjob (but not ack it.)
        DisquuunDeserializer.GetJob(disquuun.GetJob(new string[] { queueId }).DEPRICATED_Sync());

        // once, queue len should be zero by getJob.
        var len1 = DisquuunDeserializer.Qlen(disquuun.Qlen(queueId).DEPRICATED_Sync());

        Assert("_2_0_4_AddJob_Async_Retry_0_And_TTL_1Sec", len1 == 0, "not match, len1:" + len1);

        // wait 2 sec.
        Wait("_2_0_4_AddJob_Async_Retry_0_And_TTL_1Sec", 2);

        // both qlen and info returns rest job == 0.

        var len2 = DisquuunDeserializer.Qlen(disquuun.Qlen(queueId).DEPRICATED_Sync());

        Assert("_2_0_4_AddJob_Async_Retry_0_And_TTL_1Sec", len2 == 0, "not match, len2:" + len2);

        // and rest job is 0.
        var info = DisquuunDeserializer.Info(disquuun.Info().DEPRICATED_Sync());

        Assert("_2_0_4_AddJob_Async_Retry_0_And_TTL_1Sec", info.jobs.registered_jobs == 0, "not match.");
        return(0);
    }
Example #5
0
    public long _2_0_3_AddJob_Async_Retry(Disquuun disquuun)
    {
        WaitUntil("_2_0_3_AddJob_Async_Retry", () => (disquuun.State() == Disquuun.ConnectionState.OPENED), 5);

        var queueId = Guid.NewGuid().ToString();

        var jobId = string.Empty;

        disquuun.AddJob(queueId, data_10, 0, "RETRY", 1).Async(
            (command, result) =>
        {
            jobId = DisquuunDeserializer.AddJob(result);
        }
            );

        WaitUntil("_2_0_3_AddJob_Async_Retry", () => !string.IsNullOrEmpty(jobId), 5);

        var len0 = DisquuunDeserializer.Qlen(disquuun.Qlen(queueId).DEPRICATED_Sync());

        // len0 is 1. job is added.

        // getjob (but not ack it.)
        DisquuunDeserializer.GetJob(disquuun.GetJob(new string[] { queueId }).DEPRICATED_Sync());

        var len1 = DisquuunDeserializer.Qlen(disquuun.Qlen(queueId).DEPRICATED_Sync());

        // len1 is 0. job is deleted from queue.

        // wait 2 sec.
        Wait("_2_0_3_AddJob_Async_Retry", 2);

        var len2 = DisquuunDeserializer.Qlen(disquuun.Qlen(queueId).DEPRICATED_Sync());

        Assert("_2_0_3_AddJob_Async_Retry", len2 == 1, "not match, len2:" + len2);

        disquuun.FastAck(new string[] { jobId }).DEPRICATED_Sync();
        return(0);
    }
Example #6
0
    public long _1_0_3_AddJob_Sync_Retry(Disquuun disquuun)
    {
        WaitUntil("_1_0_3_AddJob_Sync_Retry", () => (disquuun.State() == Disquuun.ConnectionState.OPENED), 5);
        var w = new Stopwatch();

        w.Start();


        var queueId = Guid.NewGuid().ToString();

        var jobId = DisquuunDeserializer.AddJob(disquuun.AddJob(queueId, data_10, 0, "RETRY", 1).DEPRICATED_Sync());

        WaitUntil("_1_0_3_AddJob_Sync_Retry", () => !string.IsNullOrEmpty(jobId), 5);

        var len0 = DisquuunDeserializer.Qlen(disquuun.Qlen(queueId).DEPRICATED_Sync());

        // len0 is 1. job is added.

        // getjob (but not ack it.)
        DisquuunDeserializer.GetJob(disquuun.GetJob(new string[] { queueId }).DEPRICATED_Sync());

        var len1 = DisquuunDeserializer.Qlen(disquuun.Qlen(queueId).DEPRICATED_Sync());

        // len1 is 0. job is deleted from queue.

        // wait 2 sec.
        Wait("_1_0_3_AddJob_Sync_Retry", 2);

        var len2 = DisquuunDeserializer.Qlen(disquuun.Qlen(queueId).DEPRICATED_Sync());

        Assert("_1_0_3_AddJob_Sync_Retry", len2 == 1, "not match, len2:" + len2);
        // job is returned to queue by retry param.

        disquuun.FastAck(new string[] { jobId }).DEPRICATED_Sync();
        w.Stop();
        return(w.ElapsedMilliseconds);
    }
Example #7
0
    public void _1_8_Qlen_Sync(Disquuun disquuun)
    {
        WaitUntil("_1_8_Qlen_Sync", () => (disquuun.State() == Disquuun.ConnectionState.OPENED), 5);

        var queueId = Guid.NewGuid().ToString();
        var jobId   = DisquuunDeserializer.AddJob(
            disquuun.AddJob(queueId, new byte[10]).DEPRICATED_Sync()
            );

        var qlen = DisquuunDeserializer.Qlen(disquuun.Qlen(queueId).DEPRICATED_Sync());

        Assert("_1_8_Qlen_Sync", 1, qlen, "not match.");

        disquuun.FastAck(new string[] { jobId }).DEPRICATED_Sync();
    }
Example #8
0
    public void _2_8_Qlen_Async(Disquuun disquuun)
    {
        WaitUntil("_2_8_Qlen_Async", () => (disquuun.State() == Disquuun.ConnectionState.OPENED), 5);

        var queueId = Guid.NewGuid().ToString();
        var jobId   = DisquuunDeserializer.AddJob(
            disquuun.AddJob(queueId, new byte[10]).DEPRICATED_Sync()
            );

        var qlen = 0;

        disquuun.Qlen(queueId).Async(
            (c, data) => {
            qlen = DisquuunDeserializer.Qlen(data);
        }
            );
        WaitUntil("_2_8_Qlen_Async", () => (qlen == 1), 5);

        var result   = disquuun.FastAck(new string[] { jobId }).DEPRICATED_Sync();
        var ackCount = DisquuunDeserializer.FastAck(result);
    }
Example #9
0
    public long _1_8_Qlen_Sync(Disquuun disquuun)
    {
        WaitUntil("_1_8_Qlen_Sync", () => (disquuun.State() == Disquuun.ConnectionState.OPENED), 5);
        var w = new Stopwatch();

        w.Start();


        var queueId = Guid.NewGuid().ToString();
        var jobId   = DisquuunDeserializer.AddJob(
            disquuun.AddJob(queueId, data_10).DEPRICATED_Sync()
            );

        var qlen = DisquuunDeserializer.Qlen(disquuun.Qlen(queueId).DEPRICATED_Sync());

        Assert("_1_8_Qlen_Sync", 1, qlen, "not match.");

        disquuun.FastAck(new string[] { jobId }).DEPRICATED_Sync();
        w.Stop();
        return(w.ElapsedMilliseconds);
    }