Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pre-processor fails for messages with topic of msg/* #7

Open
avescodes opened this issue Feb 14, 2014 · 0 comments
Open

pre-processor fails for messages with topic of msg/* #7

avescodes opened this issue Feb 14, 2014 · 0 comments
Labels

Comments

@avescodes
Copy link

I am writing a multi-screen app and am trying to log incoming messages using :pre, a use case suggested by Brenton. Since I wanted to see all messages, I used a path of :** e.g.:

(defn log-input [msg]
  (.log js/console "PRE" (pr-str msg))
  [msg])

(def example-app
{...
:pre [[:* [:**] log-input]]
...}

The error I see in the JS console is "Uncaught Error: :io.pedestal.app.messages/app-modelis not ISeqable". The first messages a multi-screen app receives are in the format:

{msg/topic msg/app-model msg/type :add-named-paths :paths [] :name :example} 

It seems that dataflow/find-message-transformer can't handle msg/app-model since it's not a seqable topic. This also means that :pre can't be used to hook into msg/app-model (which I am interested in) e.g.:

:pre [[:* msg/app-model log-input]]
;; I would have thought being wrapped in a vector would work but it doesn't
:pre [[:* [msg/app-model] log-input]]

Possible solutions

  1. Consider a default :input-adapter that ensures all topics are vectors. This fixes ** and being able to select just app/model topics:

    :input-adapter (fn [m] {:key (msg/type m)
                           :out (let [topic (msg/topic m)]
                                  (if (vector? topic) topic (vector topic)))})
  2. Consider modifying dataflow/find-message-transformer to handle non-seqable topics.

  3. Accept both of these issues as limitations and document them as such.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant