Hi guys, I'm having a serious problem with rabbit and the PHP AMQPLib client. <div><br></div><div>Our system is in essence a state workflow -> events are triggered when we change state in any of our open sessions. We wanted to push processing of those events away from our fron-facing web server, so decided on trying our rabbit to create a pub-sub architecture for async processing of those events. </div><div><br></div><div>Now, those events are not a .. flood of events. We are getting around 10 - 50 per minute, and they are really small in size. We're using a fanout exchange to push them to rabbit, and multi-process them using workers running in another machine. </div><div><br></div><div>Yesterday was our first production test. We left it running for the whole day, until at around 21:00, after more or less 12 hours running ok, rabbit just stopped accepting messages. It was not dead, just not functional. </div><div><br></div><div>As I said, we're using the PhpAmqpLib client. We've written a couple of helper classes, to create a Producer, a PubSubProducer ( the former uses a topic exchange, the latter a fanout one ) and the corresponding Consumers. Can anyone see something wrong in this ?</div><div><br></div><div>The source of the pub-sub producer is more or less this:</div><div><br></div><div>
<p class="p1"><b><span class="s1">public function </span>__construct($exchange_name, $queue_name, $routing_key) </b></p><p class="p1">{</p>
<p class="p1"><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span> $this-><span class="s2">_exchange</span> <span class="Apple-tab-span">        </span>= $exchange_name;</p>
<p class="p1"><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span> $this-><span class="s2">_queue</span> <span class="Apple-tab-span">        </span>= $queue_name;</p>
<p class="p1"><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span> $this-><span class="s2">_routing_key</span> = $routing_key;</p>
<p class="p1"><span class="Apple-tab-span">        </span>}</p><p class="p1">
</p><p class="p1"><b>public function <span class="s1">initialize()</span></b></p>
<p class="p2"><span class="Apple-tab-span">        </span>{</p>
<p class="p2"><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span> $config = QueueConfig::instance();</p>
<p class="p3"><span class="Apple-tab-span">        </span><span class="Apple-tab-span">        </span></p>
<p class="p2"><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span> $this-><span class="s2">_connection</span> = <span class="s3">new </span>AMQPConnection($config-><span class="s2">host</span>, $config-><span class="s2">port</span>, $config-><span class="s2">user</span>, $config-><span class="s2">pwd</span>, $config-><span class="s2">vhost</span>);</p>
<p class="p2"><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span> $this-><span class="s2">_channel</span> = $this-><span class="s2">_connection</span>->channel();</p>
<p class="p3"><span class="Apple-tab-span">        </span><span class="Apple-tab-span">        </span></p>
<p class="p2"><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span><span class="s3"> if</span>(<span class="s3">null</span>!=$this-><span class="s2">_exchange</span>)</p>
<p class="p2"><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span> {</p>
<p class="p4"><span class="s1"><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span></span> //echo "Registering Exchange: " . $this->_exchange;</p>
<p class="p2"><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span> $this-><span class="s2">_channel</span>->exchange_declare($this-><span class="s2">_exchange</span>, <span class="s2">'fanout'</span>);</p>
<p class="p2"><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span> }</p>
<p class="p2"><span class="Apple-tab-span">        </span>}</p><p></p></div><div>
<p class="p1"><b><span class="s1">public function </span>publish($message, $routing_key = <span class="s1">null</span>, $correlation_id = <span class="s1">null</span>)</b></p>
<p class="p1"><span class="Apple-tab-span">        </span>{</p>
<p class="p1"><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span> $r_key = (<span class="s1">null </span>!= $routing_key)? $routing_key : $this-><span class="s2">_routing_key</span>;</p>
<p class="p2"><span class="Apple-tab-span">        </span><span class="Apple-tab-span">        </span></p>
<p class="p3"><span class="s3"><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span> $properties = </span><span class="s1">array</span><span class="s3">(</span>'content_type' <span class="s3">=> </span>'text/plain'<span class="s3">, </span>'delivery_mode' <span class="s3">=> 2);</span></p>
<p class="p1"><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span><span class="s1"> if</span>(<span class="s1">null </span>!= $correlation_id)</p>
<p class="p1"><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span> $properties[<span class="s2">'correlation_id'</span>] = $correlation_id;</p>
<p class="p2"><span class="Apple-tab-span">        </span><span class="Apple-tab-span">        </span></p>
<p class="p1"><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span> $msg = <span class="s1">new </span>AMQPMessage($message, $properties);</p>
<p class="p1"><span class="Apple-tab-span"></span><span class="Apple-tab-span"></span> $this-><span class="s2">_channel</span>->basic_publish($msg, $this-><span class="s2">_exchange</span>, $r_key);</p>
<p class="p1"><span class="Apple-tab-span">        </span>}</p></div><div>Thanks so much for any help guys, very very very much appreciated ! <br></div><div><br></div><div>Angel</div>