<div dir="ltr">Hi, <div><br></div><div>I have coded OpenStack AMQP listener following the example and it is working fine. </div><div></div><div><a href="https://github.com/gibizer/nova-notification-demo/blob/master/ws_forwarder.py" target="_blank">https://github.com/gibizer/nova-notification-demo/blob/master/ws_forwarder.py</a></div><div><br></div><div>The related code snippets of the NotificationHandler class are shown as follows. <br></div><div><pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:"JetBrains Mono",monospace;font-size:10.5pt"><span style="color:rgb(128,128,128)"># Initialize the AMQP listener<br></span><span style="color:rgb(204,120,50)">def </span><span style="color:rgb(255,198,109)">init</span>(<span style="color:rgb(148,85,141)">self</span><span style="color:rgb(204,120,50)">, </span>cluster_ip<span style="color:rgb(204,120,50)">, </span>user<span style="color:rgb(204,120,50)">, </span>password<span style="color:rgb(204,120,50)">, </span>port):<br>    cfg.CONF()<br>    cluster_url = <span style="color:rgb(106,135,89)">"rabbit://" </span>+ user + <span style="color:rgb(106,135,89)">":" </span>+ password + <span style="color:rgb(106,135,89)">"@" </span>+ cluster_ip + <span style="color:rgb(106,135,89)">":" </span>+ port + <span style="color:rgb(106,135,89)">"/"<br></span><span style="color:rgb(106,135,89)">    </span>transport = oslo_messaging.get_notification_transport(cfg.CONF<span style="color:rgb(204,120,50)">, </span><span style="color:rgb(170,73,38)">url</span>=cluster_url)<br>    targets = [<br>        oslo_messaging.Target(<span style="color:rgb(170,73,38)">topic</span>=<span style="color:rgb(106,135,89)">'versioned_notifications'</span>)<span style="color:rgb(204,120,50)">,<br></span><span style="color:rgb(204,120,50)">    </span>]<br>    endpoints = [<span style="color:rgb(148,85,141)">self</span>.__endpoint]<br><br>    <span style="color:rgb(128,128,128)"># Initialize the notification listener<br></span><span style="color:rgb(128,128,128)">    </span><span style="color:rgb(204,120,50)">try</span>:<br>        <span style="color:rgb(148,85,141)">self</span>.__amqp_listener = oslo_messaging.get_notification_listener(transport<span style="color:rgb(204,120,50)">,<br></span><span style="color:rgb(204,120,50)">                                                                        </span>targets<span style="color:rgb(204,120,50)">,<br></span><span style="color:rgb(204,120,50)">                                                                        </span>endpoints<span style="color:rgb(204,120,50)">,<br></span><span style="color:rgb(204,120,50)">                                                                        </span><span style="color:rgb(170,73,38)">executor</span>=<span style="color:rgb(106,135,89)">'threading'</span>)<br>    <span style="color:rgb(204,120,50)">except </span><span style="color:rgb(136,136,198)">NotImplementedError </span><span style="color:rgb(204,120,50)">as </span>err:<br>        LOGGER.error(<span style="color:rgb(106,135,89)">"Failed to initialize the notification listener {}"</span>.format(err))<br>        <span style="color:rgb(204,120,50)">return False<br></span><span style="color:rgb(204,120,50)"><br></span><span style="color:rgb(204,120,50)">    </span>LOGGER.debug(<span style="color:rgb(106,135,89)">"Initialized the notification listener {}"</span>.format(cluster_url))<br>    <span style="color:rgb(204,120,50)">return True<br></span><span style="color:rgb(204,120,50)"><br></span><span style="color:rgb(128,128,128)"># Arm the compute event listeners<br></span><span style="color:rgb(204,120,50)">def </span><span style="color:rgb(255,198,109)">start_amqp_event_listener</span>(<span style="color:rgb(148,85,141)">self</span>):<br>    <span style="color:rgb(128,128,128)"># Start the notification handler<br></span><span style="color:rgb(128,128,128)">    </span>LOGGER.debug(<span style="color:rgb(106,135,89)">"Started the OpenStack notification handler"</span>)<br>    <span style="color:rgb(148,85,141)">self</span>.__amqp_listener.start()<br><br><span style="color:rgb(128,128,128)"># Disarm the compute event listeners<br></span><span style="color:rgb(204,120,50)">def </span><span style="color:rgb(255,198,109)">stop_amqp_event_listener</span>(<span style="color:rgb(148,85,141)">self</span>):<br>    LOGGER.debug(<span style="color:rgb(106,135,89)">"Stopping the OpenStack notification handler"</span>)<br>    <span style="color:rgb(204,120,50)">if </span><span style="color:rgb(148,85,141)">self</span>.__amqp_listener <span style="color:rgb(204,120,50)">is not None</span>:<br>        <span style="color:rgb(148,85,141)">self</span>.__amqp_listener.stop()</pre>I am using this interface from a new process handler function, however, when I invoke the stop_amqp_eent_listener() method, my process hangs. It does not terminate naturally. </div><div><div>I verified that the <span style="color:rgb(148,85,141)">self</span>.__amqp_listener.stop() function is not returning. Is there anything missing in this code? Is there any specific consideration when calling the listener from a new process? </div><div><br></div><div>Can someone provide a clue? </div><div></div></div><div><pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:"JetBrains Mono",monospace;font-size:10.5pt"><span style="color:rgb(128,128,128)"># Stop the worker<br></span><span style="color:rgb(204,120,50)">def </span><span style="color:rgb(255,198,109)">stop</span>(<span style="color:rgb(148,85,141)">self</span>):<br>    <span style="color:rgb(128,128,128)"># Stop the AMQP notification handler<br></span><span style="color:rgb(128,128,128)">    </span><span style="color:rgb(148,85,141)">self</span>.__amqp_handler.stop_amqp_event_listener()<br>    LOGGER.debug(<span style="color:rgb(106,135,89)">"Stopped the worker for {}"</span>.format(<span style="color:rgb(148,85,141)">self</span>.__ops_conn_info.cluster_ip))</pre></div><div><br></div><div>/anil.</div><div><br></div><div><br></div></div>