<div dir="ltr"><div><div><a href="http://github.com/openstack/oslo.messaging" target="_blank">oslo.messaging</a> is a library that provides RPC and Notifications API, they are part of the same library for mostly historical reasons. One of the major goals of <i>oslo.messaging</i> is to provide clean RPC and Notification API without any trace of messaging queue concepts (but two of most advanced drivers used by oslo.messaging is actually based on AMQP: RabbitMQ and QPID). </div>


</div><div><br></div><div><div>We were designing Murano on messaging queue concepts using some AMQP/RabbitMQ specific features, like queue TTL. Since we never considered communications between our components in terms of RPC or Notifications and always thought about them as message exchange through broker it has influenced our components architecture. In Murano we use <a href="https://github.com/stackforge/murano-common/tree/master/muranocommon/messaging" target="_blank">simple wrapper</a> around <a href="https://github.com/majek/puka" target="_blank">Puka</a> (RabbitMQ client with most simple and thoughtful async model) that is used in all our components. We <a href="https://github.com/istalker2/puka" target="_blank">forked Puka</a> since we had specific requirements to SSL and could not yet merge <a href="https://github.com/majek/puka/pull/43" target="_blank">our work</a> back to master.</div>


</div><div><br></div><div>Can we abandon our <a href="https://github.com/stackforge/murano-common/tree/master/muranocommon/messaging" target="_blank">own wrapper</a> around our <a href="https://github.com/istalker2/puka" target="_blank">own fork of Puka</a> in favor of <i>oslo.messaging</i>? <i style="font-weight:bold">Yes</i>, but this migration may be tricky. I believe we can migrate to <i>oslo.messaging</i> in a week or so<i>.</i> </div>

<div><br></div><div>I had played with <i>oslo.messaging</i> emulating our current communication patterns with <i>oslo.messaging</i>, and I am certain that current implementation can be migrated to <i>oslo.messaging</i><i>. </i>But I am not sure that <i>oslo.messaging</i> may be easily suited to all future use-cases that we plan to cover in a few next releases without major contributions. Please, try to respond with any questions related to <i>oslo.messaging</i> implementation and how it can be fitted with certain use-case.</div>


<div><br></div><div>Below, I tried to describe our current use-cases and what specific MQ features we are using, how they may be implemented with <i>oslo.messaging </i>and with what limitations we will face. </div><div><br>

</div><div><font size="4">Use-Case</font></div>
<div>Murano has several components with communications between them based on messaging queue:<br></div><div><b>murano-api</b> -> <b>murano-conductor:</b> <br></div><div><ol><li><i>murano-api</i> sends deployment tasks to murano-conductor<br>


</li></ol></div><div><b>murano-conductor</b> -> <b>murano-api:</b></div><div><ol><li><i>murano-conductor</i> reports to <i>murano-api</i> task progress during processing<br></li><li>after processing, <i>murano-conductor</i> sends results to <i>murano-api</i><br>


</li></ol></div><div><b>murano-conductor </b>-><b> murano-agent:</b></div><div><ol><li>during task processing <i>murano-conductor</i> sends execution plans with commands to <i>murano-agent.</i> <br></li></ol><div>Note: each of mentioned components above may have more than one instance.</div>


</div><div><br></div><div>One of great messaging queue specific that we heavily use is a idea of queue itself, messages sent to component will be handled any time soon as at least one instance would be started. For example, in case of <i>murano-agent</i>, message is sent even before <i>murano-agent</i><b> </b>is started. Another one is queue life-time, we control life-time of <i>murano-agent</i> queues to exclude overflow of MQ server with queues that is not used anymore. </div>


<div><br></div><div>One thing is also worse to mention: <i>murano-conductor</i> communicates with several components at the same time: process several tasks at the same time, during task processing <i>murano-conductor</i> sends progress notifications to <i>murano-api</i> and execution plans to <i>murano-agent</i>. </div>


<div><br></div><div><font size="4">Implementation</font></div><div>Please, refer to <a href="https://wiki.openstack.org/wiki/Oslo/Messaging#Concepts" target="_blank">Concepts</a> section of <i>oslo.messaging</i> Wiki before further reading to grasp key concepts expressed in <i>oslo.messaging</i> library. In short, using RPC API we can 'call' server synchronously and receive some result, or 'cast' asynchronously (no result is returned). Using Notification API we can send Notification to the specified Target about happened event with specified event_type, importance and payload.</div>


<div><br></div><div>If we move to <i>oslo.messaging</i> we can only primarily rely on features provided by RPC/Notifications model:</div><div><ol><li>We should not rely on message delivery without other side is properly up and running. It is not a message delivery, it is <i>Remote Procedure Call;</i><br>


</li><li>To control queue life-time as we do now, we may be required to 'hack' <b>oslo.messaging</b> by writing own driver.<br></li></ol></div><div><div><b>murano-api</b> -> <b>murano-conductor:</b> <br></div>

<div>
<ol><li><i>murano-api</i> sends deployment tasks to murano-conductor: <i>May be replaced with RPC Cast</i><br></li></ol></div><div><b>murano-conductor</b> -> <b>murano-api:</b></div><div><ol><li><i>murano-conductor</i> reports to <i>murano-api</i> task progress during processing: <i>May be replaced with Notification</i> or <i>RPC Cast</i><br>


</li><li>after processing, <i>murano-conductor</i> sends results to <i>murano-api: </i><i>May be replaced with RPC Cast</i><br></li></ol></div><div><b>murano-conductor </b>-><b> murano-agent:</b></div><div><ol><li>during task processing <i>murano-conductor</i> sends execution plans with commands to <i>murano-agent</i>: <i>May be replaced with two way RPC Cast</i> (murano-agent Cast to murano-conductor with message like 'I am running', than murano-conductor Call to murano-agent with execution plan)</li>


</ol><div>Our code going to be became less clean and readable with moving to <i>oslo.messaging</i> since code that received or sends message will need to be replaced with many servers/clients and so. Communications with <i>murano-agent</i> would became more failure in-tolerant. On other hand <i>oslo.messaging </i>has very simple <a href="https://github.com/openstack/oslo.messaging/blob/master/oslo/messaging/_drivers/base.py" target="_blank">Base API</a>, so we always may implement own driver with all required functionality (and underlying tricky implementations), but I think this is should be a last resort.</div>

</div></div><div><br></div><div>-- <br><div dir="ltr">
<div>Serg Melikyan, Senior Software Engineer at Mirantis, Inc.<br></div><div><a href="http://mirantis.com/" target="_blank">http://mirantis.com</a> | <a href="mailto:smelikyan@mirantis.com" target="_blank">smelikyan@mirantis.com</a><br>


<div><br>+7 (495) 640-4904, 0261</div><div>+7 (903) 156-0836</div></div></div>
</div></div>