php - How to set Consumer started once and goes on forever uninterruptedly. -
i new rabbitmq , using rabbitmq 3.5.3, erlang r14b04, , library alvaro videla(https://github.com/videlalvaro/php-amqplib) queuing in rabbitmq. need keep consumers conection alive time not producer. the simple logic behind is, running producer through cron. after queue getting generated there no need keep producer connection alive. worker or consumer initiated once. , connection should never die.
if done cron end long list of consumer connections @ end of day, annoying, , not desirable.
so punchline here is:
1. produce queue , close connection cron every time.
2. consumer started once , goes on forever. queued consumed instantly.
can architecture built in system. necessary changes need make here.
reading description hard more or don't understand problem well. built app checking rabbit every 1 second or 3 seconds if arrive
consumer
createconnectiontorabbit while (true) { checkconnectionstillalive fetchdatafromqueue doprocessdata sleep(3) } closeconnection
producer
createconnectiontorabbit senddatatorabbit closeconnection
Comments
Post a Comment