Re: Starting a bridge in a new thread

Ian Bell <i.bell@...>



Either option is fine as Mama.start is a blocking call until Mama.stop is called, which causes it to return.

For the second one you should be aware that the call-back is invoked after Mama.start has returned, i.e. after Mama.stop is called.

Think of it as onStopComplete rather than start.

The reason for this is so that you know when it is safe to destroy transports, queues etc on shutdown.

If you use option 1 you need to take care of this interaction yourself.





From: openmama-dev-bounces@... [mailto:openmama-dev-bounces@...] On Behalf Of Hari Shyam
Sent: 19 February 2015 17:07
To: openmama-dev@...
Subject: [Openmama-dev] Starting a bridge in a new thread


Hi team,


Is it necessary to start a bridge on a separate thread?


new Thread() {

       public void run() {

              try {


              } catch (RuntimeException e) {






Or should we use this


Mama.startBackground(bridge, new MamaStartBackgroundCallback() {



                     public void onStartComplete(int paramInt) {


                 "mama started");






For the second option, the callback is never called.



This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to for additional EU corporate and regulatory disclosures and to for information about privacy.

Join to automatically receive all group messages.