Skip to content

Custom action without params #31

@faxm0dem

Description

@faxm0dem

I tried adding a cusom action without any parameters:

(defn now*
  "Sets the time of events to right now"
  [_ & children]
  (fn stream [event]
    (let [current-time (quot (System/currentTimeMillis) 1000)
          modevent (assoc event :time current-time)]
      (a/call-rescue modevent children))))

When I try to use it with the following stream:

(streams
  (stream {:name :now :default true}
    (custom :now (index [:host :service]))))

I get the following error message:

{\n :cause Key must be integer\n :via\n [{:type java.lang.IllegalArgumentException\n   :message Key must be integer\n   :at [clojure.lang.APersistentVector invoke APersistentVector.java 297]}]\n :trace\n [[clojure.lang.APersistentVector invoke APersistentVector.java 297]\n  [mirabelle.action$call_rescue invokeStatic action.clj 70]\n  [mirabelle.action$call_rescue invoke action.clj 67]\n  [abricot.core$now_STAR_$stream__254 invoke core.clj 51]\n  [mirabelle.action$call_rescue invokeStatic action.clj 70]\n  [mirabelle.action$call_rescue invoke action.clj 67]\n  [mirabelle.action$sdo_STAR_$stream__2325 invoke action.clj 418]\n  [mirabelle.stream$stream_BANG_ invokeStatic stream.clj 118]\n  [mirabelle.stream$stream_BANG_ invoke stream.clj 116]\n  [mirabelle.stream.StreamHandler push_BANG_ stream.clj 265]\n  [mirabelle.transport.tcp$gen_tcp_handler$handler_fn__13617 invoke tcp.clj 48]\n  [clojure.core$run_BANG_$fn__8880 invoke core.clj 7783]\n  [clojure.lang.ArrayChunk reduce ArrayChunk.java 58]\n  [clojure.core.protocols$fn__8244 invokeStatic protocols.clj 136]\n  [clojure.core.protocols$fn__8244 invoke protocols.clj 124]\n  [clojure.core.protocols$fn__8204$G__8199__8213 invoke protocols.clj 19]\n  [clojure.core.protocols$seq_reduce invokeStatic protocols.clj 31]\n  [clojure.core.protocols$fn__8236 invokeStatic protocols.clj 75]\n  [clojure.core.protocols$fn__8236 invoke protocols.clj

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions