#How to create a queue consumption that stays alive "observing" incoming values

27 messages · Page 1 of 1 (latest)

onyx swift
#

How to create a qeue consumption that stays alive "observing" incoming values

#

How to create a queue consumption that stays alive "observing" incoming values

queen kestrel
#

if you are using redis you need pubsub

#

but really you should just install bull and call it a day

onyx swift
#

pubsub should work as well but maybe something from node? dont know

queen kestrel
#

you need something from redis, not something from node.

#

hence pubsub.

onyx swift
#

like I told you my wish would be create something that hears some variable
doing that without library would be the best cenario

but I can only see a recursively function lol
which sounds not great

queen kestrel
#

you have a list of items

#

someone publishes changes to it

#

someone else subscribes to changes from it

onyx swift
#

I know pub sub would do the job but the thing Im justing wondering how to make it without

#

the application Im doing is just to overcomplicate everything and understand better a few things ofc in a real application I wouldnt recreate the wheel

queen kestrel
#

you can't

#

I mean you can read the whole redis database in a loop and see if there are any changes but that's insane

#

that means you keep a full copy of the whole database in memory and then you read another full copy every loop and compare

#

that's absurd

#

redis has pubsub for a reason

onyx swift
#

my core need would be how to make "a recursive function/operation to execute something when a variable changes"

#

when I say variable I can say a simple variable defined on the index of the application like a simple array

queen kestrel
#

that has no need for recursion.