Coder Social home page Coder Social logo

Comments (5)

mikhailshilkov avatar mikhailshilkov commented on August 19, 2024

Nice, that's interesting! I don't have any predisposition against Base classes, so give it a try. I'm curious to see what you can come up with. Thanks a ton!

from durablefunctions.fsharp.

richardjharding avatar richardjharding commented on August 19, 2024

struggling to see how to do this in a non breaking way - thought I could re-define the builder to use #DurableOrchestrationContextBase which compiles but the orchestration ce still expects a DurableOrchestrationContext so inheritance doesn't work as I had hoped

from durablefunctions.fsharp.

mikhailshilkov avatar mikhailshilkov commented on August 19, 2024

You should probably replace Context to ContextBase everywhere, and then you should be good, no?

from durablefunctions.fsharp.

richardjharding avatar richardjharding commented on August 19, 2024

yeah that was my first attempt and that works but that means function definitions such as this break

[<FunctionName("HelloSequence")>]
let Run ([<OrchestrationTrigger>] context: DurableOrchestrationContext) = 
    context |>    
    orchestrator {
      let! hello1 = Activity.callByName<string> "SayHello" "Tokyo"
      let! hello2 = Activity.callByName<string> "SayHello" "Seattle"
      let! hello3 = Activity.callByName<string> "SayHello" "London"

      // returns ["Hello Tokyo!", "Hello Seattle!", "Hello London!"]
      return [hello1; hello2; hello3]
    }

with

error FS0001: Type mismatch. Expecting a    'DurableOrchestra
tionContext -> 'a'    but given a    'DurableOrchestrationContextBase -> System.Threading.Tasks.Task<string list>'
 The type 'DurableOrchestrationContext' does not match the type 'DurableOrchestrationContextBase'

It would have to change to

[<FunctionName("HelloSequence")>]
let Run ([<OrchestrationTrigger>] context: DurableOrchestrationContextBase) = 
    context |>    
    orchestrator {
      let! hello1 = Activity.callByName<string> "SayHello" "Tokyo"
      let! hello2 = Activity.callByName<string> "SayHello" "Seattle"
      let! hello3 = Activity.callByName<string> "SayHello" "London"

      // returns ["Hello Tokyo!", "Hello Seattle!", "Hello London!"]
      return [hello1; hello2; hello3]
    }

so anyone taking the latest version of the library would have to change their code - I was hoping that could be avoided

from durablefunctions.fsharp.

mikhailshilkov avatar mikhailshilkov commented on August 19, 2024

Ah, thanks for the clarification!

Am I wrong or is it the only example that breaks? If so, I'm fine with this. Honestly, I think this call is awkward anyway, so maybe change it to

    let workflow = orchestrator {
      let! hello1 = Activity.callByName<string> "SayHello" "Tokyo"
      let! hello2 = Activity.callByName<string> "SayHello" "Seattle"
      let! hello3 = Activity.callByName<string> "SayHello" "London"

      // returns ["Hello Tokyo!", "Hello Seattle!", "Hello London!"]
      return [hello1; hello2; hello3]
    }
    Orchestrator.run (workflow, context)

while you are here. This shouldn't require the type change then.

from durablefunctions.fsharp.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.