Skip to content
Playground(another site)

bynk.queue.bad_params

Error An on message handler does not take exactly one message parameter.

A queue consumer is invoked once per message, so on message takes exactly one parameter: the message, of any type that can be decoded from the queue body. Two parameters leave the second with nothing to supply it, and none leaves the handler without the message. Put what you need into the message type itself: a record with those fields is one parameter. Name the parameter message by convention.

Example

type Msg = { a: String }
on message(message: Msg, extra: String) -> Effect[QueueResult] { … } // ✗ two parameters
on message(message: Msg) -> Effect[QueueResult] { … } // ✓ one message

In the Book

See also

  • The grammar rule it governs: queue_handler.
  • Every code in its category, Queue, on the diagnostic index.
  • bynk explain bynk.queue.bad_params shows the same from the installed toolchain, without a network.