Ash FrameworkAF
Ash Framework7mo ago
16 replies
VK

Can't publish the same action twice

Hello, I have a challenge with notifications that I don't know how to solve. Would appreciate any advice!

When an interaction that is part of the session is updated, I want to sent notification to both the interaction and the session. The below doesn't work:
  pub_sub do
    module FiveWhysWeb.Endpoint
    prefix "interaction"

    publish :process_response, ["response", :id]
    publish :process_response, ["updated", :session_id]
    publish :handle_error, ["error", :id]
    publish :handle_error, ["error", :session_id]
  end

None of the notifications are sent. If I comment out the repeated lines, the notifications are sent as usual.

A hack would be to do something like
pub_sub do
  ...
  publish :process_response, [["response", "updated"], [:id, :session_id]]
  ...
end

but that would send out 4 notifications to of them with wrong ids.

Any suggestions how I should approach this? Or maybe it's a feature request for Ash Notifications to support more complex templates and/or allow duplicate publish entries?
Was this page helpful?