You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "metatech (Created) (JIRA)" <ji...@apache.org> on 2012/01/31 16:39:10 UTC

[jira] [Created] (AMQ-3692) ActiveMQ OSGi bundle should be stopped when broker stops itself

ActiveMQ OSGi bundle should be stopped when broker stops itself
---------------------------------------------------------------

                 Key: AMQ-3692
                 URL: https://issues.apache.org/jira/browse/AMQ-3692
             Project: ActiveMQ
          Issue Type: Improvement
          Components: Broker
    Affects Versions: 5.4.2
         Environment: ServiceMix 4.3
            Reporter: metatech


In case of error, the ActiveMQ broker can stop itself.
In an OSGi/Blueprint environment, the bundle is however still in Active/Created state, which misleads an external monitoring software into thinking that the broker is running fine.
This patch stops the bundle when the broker stops itself.

This patch can also auto-restart the bundle, which will restart the broker.
This is critical in an Master/Slave configuration : when the connection to the database is lost, the broker cannot maintain the DB exclusive lock, and it stops itself.  The bundle should be stopped and started again, so that it enters again the "Creating" state, in which it waits to obtain the DB lock again.

The class "BrokerBundleWatcher" needs to be registered with the "shutdownHooks" property of the ActiveMQ "BrokerService".  However, there is a limitation with the XBean syntax in a Blueprint XML, which does not allow to define inner beans.  The workaround is to define the "activemq-broker.xml" in full native Blueprint syntax (no XBean).

The patch also provides a modified version of the BrokerService, that injects its own reference into the ShutdownHook's which implement the "BrokerServiceAware" interface.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (AMQ-3692) ActiveMQ OSGi bundle should be stopped when broker stops itself

Posted by "metatech (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13461113#comment-13461113 ] 

metatech commented on AMQ-3692:
-------------------------------

Claus: it is a normal ShutdownHook : the object is created during broker creation, but the "run" method is only executed when the shutdown is triggered.  The thread started within the "run" has no loop : it only runs once and then terminates.  So I think there should be no additional thread termination mechanism.  
                
> ActiveMQ OSGi bundle should be stopped when broker stops itself
> ---------------------------------------------------------------
>
>                 Key: AMQ-3692
>                 URL: https://issues.apache.org/jira/browse/AMQ-3692
>             Project: ActiveMQ
>          Issue Type: New Feature
>          Components: Broker
>    Affects Versions: 5.4.2
>         Environment: ServiceMix 4.3
>            Reporter: metatech
>             Fix For: 5.8.0
>
>         Attachments: activemq-broker.xml, BrokerBundleWatcher.patch, BrokerBundleWatcher_v2.patch, BrokerService.patch
>
>
> In case of error, the ActiveMQ broker can stop itself.
> In an OSGi/Blueprint environment, the bundle is however still in Active/Created state, which misleads an external monitoring software into thinking that the broker is running fine.
> This patch stops the bundle when the broker stops itself.
> This patch can also auto-restart the bundle, which will restart the broker.
> This is critical in an Master/Slave configuration : when the connection to the database is lost, the broker cannot maintain the DB exclusive lock, and it stops itself.  The bundle should be stopped and started again, so that it enters again the "Creating" state, in which it waits to obtain the DB lock again.
> The class "BrokerBundleWatcher" needs to be registered with the "shutdownHooks" property of the ActiveMQ "BrokerService".  However, there is a limitation with the XBean syntax in a Blueprint XML, which does not allow to define inner beans.  The workaround is to define the "activemq-broker.xml" in full native Blueprint syntax (no XBean).
> The patch also provides a modified version of the BrokerService, that injects its own reference into the ShutdownHook's which implement the "BrokerServiceAware" interface.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (AMQ-3692) ActiveMQ OSGi bundle should be stopped when broker stops itself

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3692?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated AMQ-3692:
-----------------------------

         Fix Version/s:     (was: NEEDS_REVIEWED)
                        5.8.0
    Remaining Estimate:     (was: 1h)
     Original Estimate:     (was: 1h)

A nice addition which people can chose to use by configuring it explicit.

We should look into improving the xbean so the xml supports inner beans out of the box. Feel free to look into that.
                
> ActiveMQ OSGi bundle should be stopped when broker stops itself
> ---------------------------------------------------------------
>
>                 Key: AMQ-3692
>                 URL: https://issues.apache.org/jira/browse/AMQ-3692
>             Project: ActiveMQ
>          Issue Type: New Feature
>          Components: Broker
>    Affects Versions: 5.4.2
>         Environment: ServiceMix 4.3
>            Reporter: metatech
>             Fix For: 5.8.0
>
>         Attachments: activemq-broker.xml, BrokerBundleWatcher.patch, BrokerBundleWatcher_v2.patch, BrokerService.patch
>
>
> In case of error, the ActiveMQ broker can stop itself.
> In an OSGi/Blueprint environment, the bundle is however still in Active/Created state, which misleads an external monitoring software into thinking that the broker is running fine.
> This patch stops the bundle when the broker stops itself.
> This patch can also auto-restart the bundle, which will restart the broker.
> This is critical in an Master/Slave configuration : when the connection to the database is lost, the broker cannot maintain the DB exclusive lock, and it stops itself.  The bundle should be stopped and started again, so that it enters again the "Creating" state, in which it waits to obtain the DB lock again.
> The class "BrokerBundleWatcher" needs to be registered with the "shutdownHooks" property of the ActiveMQ "BrokerService".  However, there is a limitation with the XBean syntax in a Blueprint XML, which does not allow to define inner beans.  The workaround is to define the "activemq-broker.xml" in full native Blueprint syntax (no XBean).
> The patch also provides a modified version of the BrokerService, that injects its own reference into the ShutdownHook's which implement the "BrokerServiceAware" interface.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (AMQ-3692) ActiveMQ OSGi bundle should be stopped when broker stops itself

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13458659#comment-13458659 ] 

Claus Ibsen commented on AMQ-3692:
----------------------------------

ActiveMQ provides karaf commands to check the status of brokers etc. 

Can you not use that as well? I would assume these commands can tell you that the broker is not available as well.



                
> ActiveMQ OSGi bundle should be stopped when broker stops itself
> ---------------------------------------------------------------
>
>                 Key: AMQ-3692
>                 URL: https://issues.apache.org/jira/browse/AMQ-3692
>             Project: ActiveMQ
>          Issue Type: Improvement
>          Components: Broker
>    Affects Versions: 5.4.2
>         Environment: ServiceMix 4.3
>            Reporter: metatech
>         Attachments: activemq-broker.xml, BrokerBundleWatcher.patch, BrokerBundleWatcher_v2.patch, BrokerService.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In case of error, the ActiveMQ broker can stop itself.
> In an OSGi/Blueprint environment, the bundle is however still in Active/Created state, which misleads an external monitoring software into thinking that the broker is running fine.
> This patch stops the bundle when the broker stops itself.
> This patch can also auto-restart the bundle, which will restart the broker.
> This is critical in an Master/Slave configuration : when the connection to the database is lost, the broker cannot maintain the DB exclusive lock, and it stops itself.  The bundle should be stopped and started again, so that it enters again the "Creating" state, in which it waits to obtain the DB lock again.
> The class "BrokerBundleWatcher" needs to be registered with the "shutdownHooks" property of the ActiveMQ "BrokerService".  However, there is a limitation with the XBean syntax in a Blueprint XML, which does not allow to define inner beans.  The workaround is to define the "activemq-broker.xml" in full native Blueprint syntax (no XBean).
> The patch also provides a modified version of the BrokerService, that injects its own reference into the ShutdownHook's which implement the "BrokerServiceAware" interface.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (AMQ-3692) ActiveMQ OSGi bundle should be stopped when broker stops itself

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13458658#comment-13458658 ] 

Claus Ibsen commented on AMQ-3692:
----------------------------------

Can you provide a bit more documentation how you would use this?, eg how you would configure this in the broker XML file.
                
> ActiveMQ OSGi bundle should be stopped when broker stops itself
> ---------------------------------------------------------------
>
>                 Key: AMQ-3692
>                 URL: https://issues.apache.org/jira/browse/AMQ-3692
>             Project: ActiveMQ
>          Issue Type: Improvement
>          Components: Broker
>    Affects Versions: 5.4.2
>         Environment: ServiceMix 4.3
>            Reporter: metatech
>         Attachments: activemq-broker.xml, BrokerBundleWatcher.patch, BrokerBundleWatcher_v2.patch, BrokerService.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In case of error, the ActiveMQ broker can stop itself.
> In an OSGi/Blueprint environment, the bundle is however still in Active/Created state, which misleads an external monitoring software into thinking that the broker is running fine.
> This patch stops the bundle when the broker stops itself.
> This patch can also auto-restart the bundle, which will restart the broker.
> This is critical in an Master/Slave configuration : when the connection to the database is lost, the broker cannot maintain the DB exclusive lock, and it stops itself.  The bundle should be stopped and started again, so that it enters again the "Creating" state, in which it waits to obtain the DB lock again.
> The class "BrokerBundleWatcher" needs to be registered with the "shutdownHooks" property of the ActiveMQ "BrokerService".  However, there is a limitation with the XBean syntax in a Blueprint XML, which does not allow to define inner beans.  The workaround is to define the "activemq-broker.xml" in full native Blueprint syntax (no XBean).
> The patch also provides a modified version of the BrokerService, that injects its own reference into the ShutdownHook's which implement the "BrokerServiceAware" interface.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (AMQ-3692) ActiveMQ OSGi bundle should be stopped when broker stops itself

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3692?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen updated AMQ-3692:
-----------------------------

    Fix Version/s: NEEDS_REVIEWED
       Issue Type: New Feature  (was: Improvement)
    
> ActiveMQ OSGi bundle should be stopped when broker stops itself
> ---------------------------------------------------------------
>
>                 Key: AMQ-3692
>                 URL: https://issues.apache.org/jira/browse/AMQ-3692
>             Project: ActiveMQ
>          Issue Type: New Feature
>          Components: Broker
>    Affects Versions: 5.4.2
>         Environment: ServiceMix 4.3
>            Reporter: metatech
>             Fix For: NEEDS_REVIEWED
>
>         Attachments: activemq-broker.xml, BrokerBundleWatcher.patch, BrokerBundleWatcher_v2.patch, BrokerService.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In case of error, the ActiveMQ broker can stop itself.
> In an OSGi/Blueprint environment, the bundle is however still in Active/Created state, which misleads an external monitoring software into thinking that the broker is running fine.
> This patch stops the bundle when the broker stops itself.
> This patch can also auto-restart the bundle, which will restart the broker.
> This is critical in an Master/Slave configuration : when the connection to the database is lost, the broker cannot maintain the DB exclusive lock, and it stops itself.  The bundle should be stopped and started again, so that it enters again the "Creating" state, in which it waits to obtain the DB lock again.
> The class "BrokerBundleWatcher" needs to be registered with the "shutdownHooks" property of the ActiveMQ "BrokerService".  However, there is a limitation with the XBean syntax in a Blueprint XML, which does not allow to define inner beans.  The workaround is to define the "activemq-broker.xml" in full native Blueprint syntax (no XBean).
> The patch also provides a modified version of the BrokerService, that injects its own reference into the ShutdownHook's which implement the "BrokerServiceAware" interface.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (AMQ-3692) ActiveMQ OSGi bundle should be stopped when broker stops itself

Posted by "metatech (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3692?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

metatech updated AMQ-3692:
--------------------------

    Attachment: BrokerBundleWatcher_v2.patch
    
> ActiveMQ OSGi bundle should be stopped when broker stops itself
> ---------------------------------------------------------------
>
>                 Key: AMQ-3692
>                 URL: https://issues.apache.org/jira/browse/AMQ-3692
>             Project: ActiveMQ
>          Issue Type: Improvement
>          Components: Broker
>    Affects Versions: 5.4.2
>         Environment: ServiceMix 4.3
>            Reporter: metatech
>         Attachments: BrokerBundleWatcher.patch, BrokerBundleWatcher_v2.patch, BrokerService.patch, activemq-broker.xml
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In case of error, the ActiveMQ broker can stop itself.
> In an OSGi/Blueprint environment, the bundle is however still in Active/Created state, which misleads an external monitoring software into thinking that the broker is running fine.
> This patch stops the bundle when the broker stops itself.
> This patch can also auto-restart the bundle, which will restart the broker.
> This is critical in an Master/Slave configuration : when the connection to the database is lost, the broker cannot maintain the DB exclusive lock, and it stops itself.  The bundle should be stopped and started again, so that it enters again the "Creating" state, in which it waits to obtain the DB lock again.
> The class "BrokerBundleWatcher" needs to be registered with the "shutdownHooks" property of the ActiveMQ "BrokerService".  However, there is a limitation with the XBean syntax in a Blueprint XML, which does not allow to define inner beans.  The workaround is to define the "activemq-broker.xml" in full native Blueprint syntax (no XBean).
> The patch also provides a modified version of the BrokerService, that injects its own reference into the ShutdownHook's which implement the "BrokerServiceAware" interface.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (AMQ-3692) ActiveMQ OSGi bundle should be stopped when broker stops itself

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13459427#comment-13459427 ] 

Claus Ibsen commented on AMQ-3692:
----------------------------------

The thread should be daemon, and we should also look into stopping that thread properly when the broker shutdown nicely.
                
> ActiveMQ OSGi bundle should be stopped when broker stops itself
> ---------------------------------------------------------------
>
>                 Key: AMQ-3692
>                 URL: https://issues.apache.org/jira/browse/AMQ-3692
>             Project: ActiveMQ
>          Issue Type: New Feature
>          Components: Broker
>    Affects Versions: 5.4.2
>         Environment: ServiceMix 4.3
>            Reporter: metatech
>             Fix For: 5.8.0
>
>         Attachments: activemq-broker.xml, BrokerBundleWatcher.patch, BrokerBundleWatcher_v2.patch, BrokerService.patch
>
>
> In case of error, the ActiveMQ broker can stop itself.
> In an OSGi/Blueprint environment, the bundle is however still in Active/Created state, which misleads an external monitoring software into thinking that the broker is running fine.
> This patch stops the bundle when the broker stops itself.
> This patch can also auto-restart the bundle, which will restart the broker.
> This is critical in an Master/Slave configuration : when the connection to the database is lost, the broker cannot maintain the DB exclusive lock, and it stops itself.  The bundle should be stopped and started again, so that it enters again the "Creating" state, in which it waits to obtain the DB lock again.
> The class "BrokerBundleWatcher" needs to be registered with the "shutdownHooks" property of the ActiveMQ "BrokerService".  However, there is a limitation with the XBean syntax in a Blueprint XML, which does not allow to define inner beans.  The workaround is to define the "activemq-broker.xml" in full native Blueprint syntax (no XBean).
> The patch also provides a modified version of the BrokerService, that injects its own reference into the ShutdownHook's which implement the "BrokerServiceAware" interface.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (AMQ-3692) ActiveMQ OSGi bundle should be stopped when broker stops itself

Posted by "Gary Tully (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13467613#comment-13467613 ] 

Gary Tully commented on AMQ-3692:
---------------------------------

there is also some overlap with 
http://svn.apache.org/viewvc/activemq/trunk/activemq-spring/src/main/java/org/apache/activemq/hooks/SpringOsgiContextHook.java?view=markup

which is referenced, to implement simple bundle shutdown, with bean id=hook in http://svn.apache.org/viewvc/activemq/trunk/activemq-karaf/src/main/resources/org/apache/activemq/karaf/commands/spring.xml?view=co&revision=1390204&content-type=text%2Fplain

The objective seems to be the same, but you have some extra restart smarts in your patch.
I wonder can we combine the two in some way?

                
> ActiveMQ OSGi bundle should be stopped when broker stops itself
> ---------------------------------------------------------------
>
>                 Key: AMQ-3692
>                 URL: https://issues.apache.org/jira/browse/AMQ-3692
>             Project: ActiveMQ
>          Issue Type: New Feature
>          Components: Broker
>    Affects Versions: 5.4.2
>         Environment: ServiceMix 4.3
>            Reporter: metatech
>             Fix For: 5.8.0
>
>         Attachments: activemq-broker.xml, BrokerBundleWatcher.patch, BrokerBundleWatcher_v2.patch, BrokerService.patch
>
>
> In case of error, the ActiveMQ broker can stop itself.
> In an OSGi/Blueprint environment, the bundle is however still in Active/Created state, which misleads an external monitoring software into thinking that the broker is running fine.
> This patch stops the bundle when the broker stops itself.
> This patch can also auto-restart the bundle, which will restart the broker.
> This is critical in an Master/Slave configuration : when the connection to the database is lost, the broker cannot maintain the DB exclusive lock, and it stops itself.  The bundle should be stopped and started again, so that it enters again the "Creating" state, in which it waits to obtain the DB lock again.
> The class "BrokerBundleWatcher" needs to be registered with the "shutdownHooks" property of the ActiveMQ "BrokerService".  However, there is a limitation with the XBean syntax in a Blueprint XML, which does not allow to define inner beans.  The workaround is to define the "activemq-broker.xml" in full native Blueprint syntax (no XBean).
> The patch also provides a modified version of the BrokerService, that injects its own reference into the ShutdownHook's which implement the "BrokerServiceAware" interface.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Comment Edited] (AMQ-3692) ActiveMQ OSGi bundle should be stopped when broker stops itself

Posted by "metatech (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13467970#comment-13467970 ] 

metatech edited comment on AMQ-3692 at 10/3/12 5:59 AM:
--------------------------------------------------------

Gary: the "SpringOsgiContextHook" uses Spring DM-specific API, whereas the "BrokerBundleWatcher" only uses generic OSGi API, and is therefore also compatible with Blueprint.  There is one minor modification to "BrokerBundleWatcher" which would be required to be compatible with Spring DM : Blueprint provides a "blueprintBundle" built-in variable, for which I did not find an equivalent for Spring DM.  However, Spring DM provides a "bundleContext" built-in variable (see 6.6. Accessing the BundleContext), from which the "bundle" can easily be obtained with the "getBundle()" method.  A new method "setBundleContext" would need to be added to the class.  The "BrokerBundleWatcher" could then supersede the "SpringOsgiContextHook", I think.
                
      was (Author: metatech):
    Gary: the "SpringOsgiContextHook" uses Spring DM-specific API, where the "BrokerBundleWatcher" only uses generic OSGi API, and is therefore also compatible with Blueprint.  There is one minor modification to "BrokerBundleWatcher" which would be required to be compatible with Spring DM : Blueprint provides a "blueprintBundle" built-in variable, for which I did not find an equivalent for Spring DM.  However, Spring DM provides a "bundleContext" built-in variable (see 6.6. Accessing the BundleContext), from which the "bundle" can easily be obtained with the "getBundle()" method.  A new method "setBundleContext" would need to be added to the class.  The "BrokerBundleWatcher" could then supersede the "SpringOsgiContextHook", I think.
                  
> ActiveMQ OSGi bundle should be stopped when broker stops itself
> ---------------------------------------------------------------
>
>                 Key: AMQ-3692
>                 URL: https://issues.apache.org/jira/browse/AMQ-3692
>             Project: ActiveMQ
>          Issue Type: New Feature
>          Components: Broker
>    Affects Versions: 5.4.2
>         Environment: ServiceMix 4.3
>            Reporter: metatech
>             Fix For: 5.8.0
>
>         Attachments: activemq-broker.xml, BrokerBundleWatcher.patch, BrokerBundleWatcher_v2.patch, BrokerService.patch
>
>
> In case of error, the ActiveMQ broker can stop itself.
> In an OSGi/Blueprint environment, the bundle is however still in Active/Created state, which misleads an external monitoring software into thinking that the broker is running fine.
> This patch stops the bundle when the broker stops itself.
> This patch can also auto-restart the bundle, which will restart the broker.
> This is critical in an Master/Slave configuration : when the connection to the database is lost, the broker cannot maintain the DB exclusive lock, and it stops itself.  The bundle should be stopped and started again, so that it enters again the "Creating" state, in which it waits to obtain the DB lock again.
> The class "BrokerBundleWatcher" needs to be registered with the "shutdownHooks" property of the ActiveMQ "BrokerService".  However, there is a limitation with the XBean syntax in a Blueprint XML, which does not allow to define inner beans.  The workaround is to define the "activemq-broker.xml" in full native Blueprint syntax (no XBean).
> The patch also provides a modified version of the BrokerService, that injects its own reference into the ShutdownHook's which implement the "BrokerServiceAware" interface.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (AMQ-3692) ActiveMQ OSGi bundle should be stopped when broker stops itself

Posted by "metatech (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13467970#comment-13467970 ] 

metatech commented on AMQ-3692:
-------------------------------

Gary: the "SpringOsgiContextHook" uses Spring DM-specific API, where the "BrokerBundleWatcher" only uses generic OSGi API, and is therefore also compatible with Blueprint.  There is one minor modification to "BrokerBundleWatcher" which would be required to be compatible with Spring DM : Blueprint provides a "blueprintBundle" built-in variable, for which I did not find an equivalent for Spring DM.  However, Spring DM provides a "bundleContext" built-in variable (see 6.6. Accessing the BundleContext), from which the "bundle" can easily be obtained with the "getBundle()" method.  A new method "setBundleContext" would need to be added to the class.  The "BrokerBundleWatcher" could then supersede the "SpringOsgiContextHook", I think.
                
> ActiveMQ OSGi bundle should be stopped when broker stops itself
> ---------------------------------------------------------------
>
>                 Key: AMQ-3692
>                 URL: https://issues.apache.org/jira/browse/AMQ-3692
>             Project: ActiveMQ
>          Issue Type: New Feature
>          Components: Broker
>    Affects Versions: 5.4.2
>         Environment: ServiceMix 4.3
>            Reporter: metatech
>             Fix For: 5.8.0
>
>         Attachments: activemq-broker.xml, BrokerBundleWatcher.patch, BrokerBundleWatcher_v2.patch, BrokerService.patch
>
>
> In case of error, the ActiveMQ broker can stop itself.
> In an OSGi/Blueprint environment, the bundle is however still in Active/Created state, which misleads an external monitoring software into thinking that the broker is running fine.
> This patch stops the bundle when the broker stops itself.
> This patch can also auto-restart the bundle, which will restart the broker.
> This is critical in an Master/Slave configuration : when the connection to the database is lost, the broker cannot maintain the DB exclusive lock, and it stops itself.  The bundle should be stopped and started again, so that it enters again the "Creating" state, in which it waits to obtain the DB lock again.
> The class "BrokerBundleWatcher" needs to be registered with the "shutdownHooks" property of the ActiveMQ "BrokerService".  However, there is a limitation with the XBean syntax in a Blueprint XML, which does not allow to define inner beans.  The workaround is to define the "activemq-broker.xml" in full native Blueprint syntax (no XBean).
> The patch also provides a modified version of the BrokerService, that injects its own reference into the ShutdownHook's which implement the "BrokerServiceAware" interface.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (AMQ-3692) ActiveMQ OSGi bundle should be stopped when broker stops itself

Posted by "metatech (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13458946#comment-13458946 ] 

metatech commented on AMQ-3692:
-------------------------------

Claus, the attached activemq-broker.xml shows how the class is registered as a shutdown hook of the broker.
The ActiveMQ Karaf commands must be run manually : the idea of the patch is that the broker is monitored and auto-restarted automatically, without human intervention nor polling script.

                
> ActiveMQ OSGi bundle should be stopped when broker stops itself
> ---------------------------------------------------------------
>
>                 Key: AMQ-3692
>                 URL: https://issues.apache.org/jira/browse/AMQ-3692
>             Project: ActiveMQ
>          Issue Type: New Feature
>          Components: Broker
>    Affects Versions: 5.4.2
>         Environment: ServiceMix 4.3
>            Reporter: metatech
>             Fix For: NEEDS_REVIEWED
>
>         Attachments: activemq-broker.xml, BrokerBundleWatcher.patch, BrokerBundleWatcher_v2.patch, BrokerService.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In case of error, the ActiveMQ broker can stop itself.
> In an OSGi/Blueprint environment, the bundle is however still in Active/Created state, which misleads an external monitoring software into thinking that the broker is running fine.
> This patch stops the bundle when the broker stops itself.
> This patch can also auto-restart the bundle, which will restart the broker.
> This is critical in an Master/Slave configuration : when the connection to the database is lost, the broker cannot maintain the DB exclusive lock, and it stops itself.  The bundle should be stopped and started again, so that it enters again the "Creating" state, in which it waits to obtain the DB lock again.
> The class "BrokerBundleWatcher" needs to be registered with the "shutdownHooks" property of the ActiveMQ "BrokerService".  However, there is a limitation with the XBean syntax in a Blueprint XML, which does not allow to define inner beans.  The workaround is to define the "activemq-broker.xml" in full native Blueprint syntax (no XBean).
> The patch also provides a modified version of the BrokerService, that injects its own reference into the ShutdownHook's which implement the "BrokerServiceAware" interface.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (AMQ-3692) ActiveMQ OSGi bundle should be stopped when broker stops itself

Posted by "metatech (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AMQ-3692?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13199638#comment-13199638 ] 

metatech commented on AMQ-3692:
-------------------------------

Here is a new version of the patch, that prevents self-deadlock and also adds two properties ("minUptime" and "restartDelay").
                
> ActiveMQ OSGi bundle should be stopped when broker stops itself
> ---------------------------------------------------------------
>
>                 Key: AMQ-3692
>                 URL: https://issues.apache.org/jira/browse/AMQ-3692
>             Project: ActiveMQ
>          Issue Type: Improvement
>          Components: Broker
>    Affects Versions: 5.4.2
>         Environment: ServiceMix 4.3
>            Reporter: metatech
>         Attachments: BrokerBundleWatcher.patch, BrokerBundleWatcher_v2.patch, BrokerService.patch, activemq-broker.xml
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In case of error, the ActiveMQ broker can stop itself.
> In an OSGi/Blueprint environment, the bundle is however still in Active/Created state, which misleads an external monitoring software into thinking that the broker is running fine.
> This patch stops the bundle when the broker stops itself.
> This patch can also auto-restart the bundle, which will restart the broker.
> This is critical in an Master/Slave configuration : when the connection to the database is lost, the broker cannot maintain the DB exclusive lock, and it stops itself.  The bundle should be stopped and started again, so that it enters again the "Creating" state, in which it waits to obtain the DB lock again.
> The class "BrokerBundleWatcher" needs to be registered with the "shutdownHooks" property of the ActiveMQ "BrokerService".  However, there is a limitation with the XBean syntax in a Blueprint XML, which does not allow to define inner beans.  The workaround is to define the "activemq-broker.xml" in full native Blueprint syntax (no XBean).
> The patch also provides a modified version of the BrokerService, that injects its own reference into the ShutdownHook's which implement the "BrokerServiceAware" interface.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (AMQ-3692) ActiveMQ OSGi bundle should be stopped when broker stops itself

Posted by "metatech (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AMQ-3692?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

metatech updated AMQ-3692:
--------------------------

    Attachment: activemq-broker.xml
                BrokerService.patch
                BrokerBundleWatcher.patch
    
> ActiveMQ OSGi bundle should be stopped when broker stops itself
> ---------------------------------------------------------------
>
>                 Key: AMQ-3692
>                 URL: https://issues.apache.org/jira/browse/AMQ-3692
>             Project: ActiveMQ
>          Issue Type: Improvement
>          Components: Broker
>    Affects Versions: 5.4.2
>         Environment: ServiceMix 4.3
>            Reporter: metatech
>         Attachments: BrokerBundleWatcher.patch, BrokerService.patch, activemq-broker.xml
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> In case of error, the ActiveMQ broker can stop itself.
> In an OSGi/Blueprint environment, the bundle is however still in Active/Created state, which misleads an external monitoring software into thinking that the broker is running fine.
> This patch stops the bundle when the broker stops itself.
> This patch can also auto-restart the bundle, which will restart the broker.
> This is critical in an Master/Slave configuration : when the connection to the database is lost, the broker cannot maintain the DB exclusive lock, and it stops itself.  The bundle should be stopped and started again, so that it enters again the "Creating" state, in which it waits to obtain the DB lock again.
> The class "BrokerBundleWatcher" needs to be registered with the "shutdownHooks" property of the ActiveMQ "BrokerService".  However, there is a limitation with the XBean syntax in a Blueprint XML, which does not allow to define inner beans.  The workaround is to define the "activemq-broker.xml" in full native Blueprint syntax (no XBean).
> The patch also provides a modified version of the BrokerService, that injects its own reference into the ShutdownHook's which implement the "BrokerServiceAware" interface.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira