简体   繁体   中英

Transloadit cannot get ASSEMBLY_COMPLETED response in c#.net

With the reference from below link

https://github.com/nkranitz/transloadit-csharp-sdk Am using transloadit for video converting and saving it in s3 in C#. I am able to upload the video and image and am able to get the response with empty results. My response had "ok": "ASSEMBLY_EXECUTING", message and the results tag is empty. So am not getting the final response once the assembly is executed like ASSEMBLY_COMPLETED. So, i see that there is some property assembly.setblocking = true.. but in C# that property is not available. So how can i get the final response or how can i use blocking property in c#.net

Please help me out in solving this issue.

Thanks in advance.

Below is the code snippet

ITransloadit transloadit = new Transloadit.Transloadit("APIKEY", "Secret");

        //Create assembly builder to build up the assembly
        IAssemblyBuilder assembly = new AssemblyBuilder();
        //Add a file to be uploaded (with autogenerated key)
        assembly.AddFile(@"filepath"); 

       //Define the step, you can define more in the same assembly
        IStep step = new Step();
        step.SetOption("robot", "/image/resize");
        step.SetOption("width", 75);
        step.SetOption("height", 75);
        step.SetOption("resize_strategy", "pad");
        step.SetOption("background", "#000000");

        //Add the step to the assembly
        assembly.AddStep("thumb", step);

        //Set notification URL
        assembly.SetNotifyURL("url");

        //Set the expiration date time of the request for the assembly
        //Assembly will be expired in 120 minutes from now
        assembly.SetAuthExpires(DateTime.Now.AddMinutes(120));
        //Invoke assembly, and wait for the result
        TransloaditResponse response = transloadit.InvokeAssembly(assembly);

        if (response.Success)
        {
          //  LoggerFactory.GetLogger().LogInfo(Type.GetType("TestConsole.Program"), "Assembly {0} result", response.Data);
        }

In that first response, you should see an assembly_url . You can/should poll that URL every X seconds to get the updates. When the assembly reaches ASSEMBLY_CANCELED ASSEMBLY_COMPLETED REQUEST_ABORTED , or the error is set, it's done. I'm not sure if the boilerplate for this polling is implemented in the SDK, you'd have to check.

Blocking assemblies are not recommended as they require to keep the connection open, which is more brittle.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM