ash notifier pubsub question
I've got a scenario where pub sub from one resource works, and then another resource where it does not.
in the live view we're subscribed and handling:
this resource works:
this one does not:
I've gone a few rounds with the LLM and haven't been able to get this to work. The
transform
being the thing that's different between the two resources, so I suspect I'm doing something different.21 Replies
Any info beyond not working? How is it not working?
the live view doesn't see the event
i sprinked in some logging inside the transform that does not work and see this:
added some logs to the live view handle_info and for the resource where it does work I see this, which tells me things are wired up correctly.
There is a pubsub notifier debug option
Not at all computer so I can't link you to it
But it will log all sent messages maybe that will help
config :ash, :pub_sub, debug?: true
that look like it?
Yes
How are you doing the create in question?
it's the double entry transfer create, with this:
create_accept [:payee, :timestamp, :transfer_date]
Do you see smth like
for your second / not working broadcast, to check if its a broadcast or handle info issue?
for the that works I see this:
and the one that does not:
hrm
oki, so the issue is the missing topic
could you show more of the pubsub resource code? (the one not working)
let me remove the logging to make it easier to read
there is no budget_id on the transfer resource, so I fetch the account which does have budget_id
this logging statement happens before my pubsub transform logging statement:
[debug] Broadcasting to topics [] via AppWeb.Endpoint.broadcast
[info] Transfer PubSub: Processing CREATE for budget 078f18dd-2c0c-458f-be57-23408b1a2297
hm dont see anything strange
you could try rewriting it to
just to check plain stupid if its the pubsub
the broadcast should not be empty than
that works:
[debug] Broadcasting to topics ["budget:078f18dd-2c0c-458f-be57-23408b1a2297"] via AppWeb.Endpoint.broadcast
so you have no budget_id on the resource creating the not working pubsub?
not sure if this is an issue or the transform function
but i think i would try debugging it stepwise
if its empty again, try without transform func
if its working test your transform func via iex etc
i think it's because :budget_id does not exist on transfer
if i switch it to a key that exists, then I see a topic broadcasted
you dont have to use it, it can be anything, just subscribe accordingly where you want to have a handle_info
aye, I think the issue is mostly with my architecture. i was trying to reduce the number of topics I subscribe to in the live view
ps: what also works is
to
ty both for the help this morning
time to pack up and head to tennessee to pick up a new puppy 🥰
enjoy the weekend
check out that floof ball!