You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by Christian Schneider <ch...@die-schneider.net> on 2015/11/20 15:17:35 UTC

Artemis OSGi: Prototype available

I created a branch on my github account that shows how we can run 
Artemis in OSGi.
I started with the ueber bundle branch of Guillaume but wanted to create 
a more modular solution.

As we have all these duplicate packages I was not able to make each jar 
a separate bundle. I needed to combine
the artemis-commons, artemis-core-client and artemis-server as they 
contain most of the duplicates.  I also added the jms support
as it will probably be always needed. Everything that artemis-server 
depends on also needed to be included as else the bundles would have 
circular references.

I split off all protocols though. Each protocol published a service and 
the artemis-server-osgi bundle picks up the services to populate the 
ProtocolManagerFactory list.
Currently this is done in a very simplistic way but it can be improved 
to wait for all needed protocols that are listed in a config.

Apart from the duplicate packages the Artemis behaves quite well in OSGi.

See
https://github.com/cschneider/activemq-artemis/tree/OSGi

You can install Artemis with all protocols using:
feature:repo-add mvn:org.apache.activemq/artemis-features/1.1.1-SNAPSHOT/xml
feature:install artemis-core artemis-hornetq artemis-stomp artemis-mqtt 
artemis-amqp

I would be happy about your feedback.

Christian

-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


Re: Artemis OSGi: Prototype available

Posted by Clebert Suconic <cl...@gmail.com>.
I ran a few tests with this and it seems fine (hence I merged it).

just one thing on this.. I think it we could add more tests.. (and
maybe one example, since that has double purpose.. docs and indirectly
gives us nice smoke tests)

I think we could improve this further by bumping the release into 2.0
next year and fix these packages. We should have a release soon with
the current master, and if we bump the release as 2.0 we can make
small changes to the API. (I don't think we should do any drastic
changes).



On Sun, Nov 22, 2015 at 2:27 AM, Christian Schneider
<ch...@die-schneider.net> wrote:
>
>
> Am 21.11.2015 um 11:28 schrieb Guillaume Nodet:
>>
>> Good work !
>>
>> A few remarks:
>>    * the native bundle needs some specific headers for loading the native
>> libraries I think
>
> I have not looked into the native module in detail but most probably yes.
>>
>>    * the protocol tracking needs to be done with a real service tracker,
>> shutting down the server if the protocol service is unregistered, and
>> waiting for the protocols needed in the configuration (and printing a log
>> message to know  what the configuration is waiting for)
>
> Yes. That part needs to be improved. Currently it is too brittle and also
> does not cope with changes once artemis is up.
>
> This is what have in mind for it:
> 1. Read the config and find the needed protocols. I hope we can use the
> existing FileConfiguration for this and extract the information
> 2. Create a service tracker that tracks all ProtocolManagerFactory services
> and for each service added / removed checks the difference between
> the wanted and present protocols. While not all needed protocols are present
> it can print that the server can not yet start as a list of protocols is
> missing.
> 3. Once the last missing protocol comes up the Artemis server is started
> 4. When one of the necessary protocols goes down the Artemis server is
> stopped again
>
> So this should then be able to adapt to changes.
>
> At a later point we can think of changing the Artemis design so it can adapt
> to protocol availability without restarting Artemis. So the server could
> start without the protocols and
> add and remove them online. I do not think we strictily need this to get
> started with OSGi though.
>
>>    * the protocol factory services need to have a list of protocols on the
>> properties (those obtained from ProtocolManagerFactory#getProtocols() so
>> that they can be tracked correctly I think
>
> I think we can do without the properties on the service level. We can simply
> track all services and
> ask each service for the protocols it supports.
>>
>>     * i think we should provide a ready-to-use feature with default
>> configuration, such as ActiveMQ provides (installing the default config in
>> etc/artemis.xml and needed configadmin config for the broker factory)
>
> +1
>
>
> Christian
>



-- 
Clebert Suconic

Re: Artemis OSGi: Prototype available

Posted by Christian Schneider <ch...@die-schneider.net>.

Am 21.11.2015 um 11:28 schrieb Guillaume Nodet:
> Good work !
>
> A few remarks:
>    * the native bundle needs some specific headers for loading the native
> libraries I think
I have not looked into the native module in detail but most probably yes.
>    * the protocol tracking needs to be done with a real service tracker,
> shutting down the server if the protocol service is unregistered, and
> waiting for the protocols needed in the configuration (and printing a log
> message to know  what the configuration is waiting for)
Yes. That part needs to be improved. Currently it is too brittle and 
also does not cope with changes once artemis is up.

This is what have in mind for it:
1. Read the config and find the needed protocols. I hope we can use the 
existing FileConfiguration for this and extract the information
2. Create a service tracker that tracks all ProtocolManagerFactory 
services and for each service added / removed checks the difference between
the wanted and present protocols. While not all needed protocols are 
present it can print that the server can not yet start as a list of 
protocols is missing.
3. Once the last missing protocol comes up the Artemis server is started
4. When one of the necessary protocols goes down the Artemis server is 
stopped again

So this should then be able to adapt to changes.

At a later point we can think of changing the Artemis design so it can 
adapt to protocol availability without restarting Artemis. So the server 
could start without the protocols and
add and remove them online. I do not think we strictily need this to get 
started with OSGi though.

>    * the protocol factory services need to have a list of protocols on the
> properties (those obtained from ProtocolManagerFactory#getProtocols() so
> that they can be tracked correctly I think
I think we can do without the properties on the service level. We can 
simply track all services and
ask each service for the protocols it supports.
>     * i think we should provide a ready-to-use feature with default
> configuration, such as ActiveMQ provides (installing the default config in
> etc/artemis.xml and needed configadmin config for the broker factory)
+1


Christian


Re: Artemis OSGi: Prototype available

Posted by Guillaume Nodet <gn...@apache.org>.
Good work !

A few remarks:
  * the native bundle needs some specific headers for loading the native
libraries I think
  * the protocol tracking needs to be done with a real service tracker,
shutting down the server if the protocol service is unregistered, and
waiting for the protocols needed in the configuration (and printing a log
message to know  what the configuration is waiting for)
  * the protocol factory services need to have a list of protocols on the
properties (those obtained from ProtocolManagerFactory#getProtocols() so
that they can be tracked correctly I think
   * i think we should provide a ready-to-use feature with default
configuration, such as ActiveMQ provides (installing the default config in
etc/artemis.xml and needed configadmin config for the broker factory)

2015-11-20 15:17 GMT+01:00 Christian Schneider <ch...@die-schneider.net>:

> I created a branch on my github account that shows how we can run Artemis
> in OSGi.
> I started with the ueber bundle branch of Guillaume but wanted to create a
> more modular solution.
>
> As we have all these duplicate packages I was not able to make each jar a
> separate bundle. I needed to combine
> the artemis-commons, artemis-core-client and artemis-server as they
> contain most of the duplicates.  I also added the jms support
> as it will probably be always needed. Everything that artemis-server
> depends on also needed to be included as else the bundles would have
> circular references.
>
> I split off all protocols though. Each protocol published a service and
> the artemis-server-osgi bundle picks up the services to populate the
> ProtocolManagerFactory list.
> Currently this is done in a very simplistic way but it can be improved to
> wait for all needed protocols that are listed in a config.
>
> Apart from the duplicate packages the Artemis behaves quite well in OSGi.
>
> See
> https://github.com/cschneider/activemq-artemis/tree/OSGi
>
> You can install Artemis with all protocols using:
> feature:repo-add
> mvn:org.apache.activemq/artemis-features/1.1.1-SNAPSHOT/xml
> feature:install artemis-core artemis-hornetq artemis-stomp artemis-mqtt
> artemis-amqp
>
> I would be happy about your feedback.
>
> Christian
>
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> http://www.talend.com
>
>

Re: Artemis OSGi: Prototype available

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Great work Christian !

Let me take a deeper look over the week end.

Regards
JB

On 11/20/2015 03:17 PM, Christian Schneider wrote:
> I created a branch on my github account that shows how we can run
> Artemis in OSGi.
> I started with the ueber bundle branch of Guillaume but wanted to create
> a more modular solution.
>
> As we have all these duplicate packages I was not able to make each jar
> a separate bundle. I needed to combine
> the artemis-commons, artemis-core-client and artemis-server as they
> contain most of the duplicates.  I also added the jms support
> as it will probably be always needed. Everything that artemis-server
> depends on also needed to be included as else the bundles would have
> circular references.
>
> I split off all protocols though. Each protocol published a service and
> the artemis-server-osgi bundle picks up the services to populate the
> ProtocolManagerFactory list.
> Currently this is done in a very simplistic way but it can be improved
> to wait for all needed protocols that are listed in a config.
>
> Apart from the duplicate packages the Artemis behaves quite well in OSGi.
>
> See
> https://github.com/cschneider/activemq-artemis/tree/OSGi
>
> You can install Artemis with all protocols using:
> feature:repo-add
> mvn:org.apache.activemq/artemis-features/1.1.1-SNAPSHOT/xml
> feature:install artemis-core artemis-hornetq artemis-stomp artemis-mqtt
> artemis-amqp
>
> I would be happy about your feedback.
>
> Christian
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Artemis OSGi: Prototype available

Posted by Andy Taylor <an...@gmail.com>.
I'll spend some time on Monday looking at it

On Fri, 20 Nov 2015 14:17 Christian Schneider <ch...@die-schneider.net>
wrote:

> I created a branch on my github account that shows how we can run
> Artemis in OSGi.
> I started with the ueber bundle branch of Guillaume but wanted to create
> a more modular solution.
>
> As we have all these duplicate packages I was not able to make each jar
> a separate bundle. I needed to combine
> the artemis-commons, artemis-core-client and artemis-server as they
> contain most of the duplicates.  I also added the jms support
> as it will probably be always needed. Everything that artemis-server
> depends on also needed to be included as else the bundles would have
> circular references.
>
> I split off all protocols though. Each protocol published a service and
> the artemis-server-osgi bundle picks up the services to populate the
> ProtocolManagerFactory list.
> Currently this is done in a very simplistic way but it can be improved
> to wait for all needed protocols that are listed in a config.
>
> Apart from the duplicate packages the Artemis behaves quite well in OSGi.
>
> See
> https://github.com/cschneider/activemq-artemis/tree/OSGi
>
> You can install Artemis with all protocols using:
> feature:repo-add
> mvn:org.apache.activemq/artemis-features/1.1.1-SNAPSHOT/xml
> feature:install artemis-core artemis-hornetq artemis-stomp artemis-mqtt
> artemis-amqp
>
> I would be happy about your feedback.
>
> Christian
>
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> http://www.talend.com
>
>