question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

=> operator does not work in place of Via

See original GitHub issue
open Akka
open Akka.Actor
open Akka.Streams
open Akka.Streams.Dsl
open Akkling
open Akkling.Streams
open Akkling.Streams.Operators

type IUser = interface end
type IHashtagEntity = interface end

type ITweet = 
    abstract Hashtags: IHashtagEntity list
    abstract CreatedBy: IUser

[<EntryPoint>]
let main _ = 
    use system = ActorSystem.Create("test")
    let mat = system.Materializer()
    
    GraphDsl.Create (fun b ->
        let broadcast = b.Add(Broadcast<ITweet>(2))
        

        b.From(broadcast.Out(0)).Via(Flow.id |> Flow.map (fun (tweet: ITweet) -> tweet.CreatedBy)) |> ignore
        b.From(broadcast.Out(0)) => (Flow.id |> Flow.map (fun (tweet: ITweet) -> tweet.CreatedBy)) |> ignore

        
        ClosedShape.Instance
    ) 
    |> RunnableGraph.FromGraph
    |> Graph.run mat
    |> ignore
    0

image

image

I expect Flow<ITweet, IUser, NotUsed> here instead of Flow<ITweet, ITweet, NotUsed>.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
Horusiathcommented, Jan 13, 2021
  1. If you have Broadcast(1), then you don’t need broadcast at all.

  2. Think of stages as building blocks with inputs and outputs. Graph.create requies you to either join all of them together (so that there are no dangling in-/outputs), or expose them outside:

    • In your case your Flow.id |> Flow.map (..) |> ignore is not closed, as output of Flow.map is still dangling around (just ignored). After Via call, it needs to be connected i.e. to Sink.ignore stage (if you don’t want to do anything with it).
    • You defined broadcast and connected its only output, but still left input disconnected from the rest of the graph. You may want to decide to expose it outside by using SinkShape<_>(broadcast.In), which will produce a sink. You can then connect that sink with the source of your choice to materialize it into fully functioning graph.

You may also want to take a look at the example of using Akkling graph API.

1reaction
Horusiathcommented, Dec 20, 2017

I’m not sure right now, but I guess, that the current definition of => may have been not precise enough, and F# type inference gone to the wrong conclusion. So far I still struggle to make Graph DSL F#-friendly.

Unfortunately original Akka GraphDSL uses almost all scala-specific features in one place (implicit params, implicit type casting, custom operators with multiple overloads etc.). It’s hard to create something remotely similar in any other language.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why don't C++ compilers define operator== and operator!
I personally consider it unfortunate that copy operations are defined by default and I prohibit copying of objects of many of my classes....
Read more >
pipe operator not working - General
The pipe operator is not working. I get this error message, (could not find function "%>%"). I have installed and loaded tidyverse.
Read more >
Not equal to comparison operator does not work
I have a list of opportunities that I fetched via SOQL query. I am trying to check if any of the fetched opportunities...
Read more >
`Like` operator does not work for internal tables · Issue #3386
When using a filter on a Data Provider , with internal tables, the Like operator does not work. It works fine on SQL....
Read more >
JQL operators | Jira Software Cloud
The "WAS NOT IN" operator is used to search for issues where the value of the specified field has never been one of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found