Giter Club home page Giter Club logo

Comments (5)

kschltz avatar kschltz commented on July 18, 2024

I believe fn signature would be better like (fn[v]...), then willa could compose it in something like
(fn[[k v]] [k (your-fn v)])

from willa.

madstap avatar madstap commented on July 18, 2024

I left the key in as an argument because it seems useful to be able to know the key inside the function. In my current use-case the key is also a field in the value, so I don't strictly need it. The reasoning behind including it is that if we do it is easy to ignore, but if we don't include it, there's nothing we can do if we need it.

An alternative could be to have 2 different ones, (map (fn [v] v)) and (map (fn [[k v]] v)), which would also cover both use-cases.

from willa.

DaveWM avatar DaveWM commented on July 18, 2024

hey @madstap, apologies for taking so long to respond - I only just noticed this issue 🤦‍♂️.

I am aware of this issue, but actually I'd like to avoid adding this functionality to Willa if possible. Although it would allow you to avoid unnecessary repartitions, it comes at the cost of making Willa's API larger and requiring the user to have more knowledge of the underlying Kafka Streams library. My aim is to keep Willa's API as simple as possible, so I decided to leave this functionality out. However I'm making the assumption that unnecessary repartitions are a minor annoyance rather than a serious problem, if that's not the case for you please let me know and I'll have a think about how Willa could support this.

For now, if you need to call map-values there is an (undocumented) "escape hatch" built in to Willa. Instead of calling build-topolgy!, you can call build-topology-unsafe! which accepts an extra parameter called overrides. This is a map of entity id -> builder fn, where the builder function is responsible for calling methods on the KStreamBuilder object. It takes in 4 arguments, but I think you'll only need the first 2: entity (the entity map defined in your topology) and builder (the KStreamBuilder object). In your case, you should be able to add an override for the relevant :kstream entity, which will create the KStream object and then call map-values on it.

from willa.

DaveWM avatar DaveWM commented on July 18, 2024

I'll close this issue for now, if you really need this functionality please let me know and I'll reopen the issue

from willa.

DaveWM avatar DaveWM commented on July 18, 2024

@madstap I've added a way to do this in version 0.3.0. You can now set the willa.overrides/prevent-repartition option on the kstream entity to prevent KS creating a repartition.

from willa.

Related Issues (16)

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.