ActiveMQ v5 plugin migration to Artemis

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

ActiveMQ v5 plugin migration to Artemis

David Martin-2
Hi everyone,

Decided to switch to Artemis which is not going to be difficult in the main
but not sure of my best option to migrate a broker plugin which overrides
*addConsumer()* to set a new destination and a message selector using
broker-side business logic based on the user credentials. It looks like I
might be able to do this as a plugin or as an interceptor and not sure what
to override on either of these interfaces?

Any help/pointers appreciated.

Thanks,

Dave
Reply | Threaded
Open this post in threaded view
|

Re: ActiveMQ v5 plugin migration to Artemis

christopher.l.shannon
Take a look at the plugin API for Artemis:
https://activemq.apache.org/components/artemis/documentation/latest/broker-plugins.html

Specifically you can implement your own ActiveMQServerPlugin (which extends
many other plugin interfaces) and has a ton of hooks into the broker to do
what you need.  ActiveMQServerConsumerPlugin probably has the methods you
need.

https://github.com/apache/activemq-artemis/blob/master/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/ActiveMQServerConsumerPlugin.java

On Thu, Feb 13, 2020 at 9:59 AM David Martin <[hidden email]> wrote:

> Hi everyone,
>
> Decided to switch to Artemis which is not going to be difficult in the main
> but not sure of my best option to migrate a broker plugin which overrides
> *addConsumer()* to set a new destination and a message selector using
> broker-side business logic based on the user credentials. It looks like I
> might be able to do this as a plugin or as an interceptor and not sure what
> to override on either of these interfaces?
>
> Any help/pointers appreciated.
>
> Thanks,
>
> Dave
>
Reply | Threaded
Open this post in threaded view
|

Re: ActiveMQ v5 plugin migration to Artemis

David Martin-2
Thanks Chris -

Unfortunately what I need to override (queue name and filter) is read only:

https://github.com/apache/activemq-artemis/blob/master/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ConsumerInfo.java

Wondering whether an interceptor is what I need? Unless I'm missing
something blindingly obvious about these interfaces for plugins .


Dave

On Fri, Feb 14, 2020, 2:06 PM Christopher Shannon <
[hidden email]> wrote:

> Take a look at the plugin API for Artemis:
>
> https://activemq.apache.org/components/artemis/documentation/latest/broker-plugins.html
>
> Specifically you can implement your own ActiveMQServerPlugin (which extends
> many other plugin interfaces) and has a ton of hooks into the broker to do
> what you need.  ActiveMQServerConsumerPlugin probably has the methods you
> need.
>
>
> https://github.com/apache/activemq-artemis/blob/master/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/ActiveMQServerConsumerPlugin.java
>
> On Thu, Feb 13, 2020 at 9:59 AM David Martin <[hidden email]> wrote:
>
> > Hi everyone,
> >
> > Decided to switch to Artemis which is not going to be difficult in the
> main
> > but not sure of my best option to migrate a broker plugin which overrides
> > *addConsumer()* to set a new destination and a message selector using
> > broker-side business logic based on the user credentials. It looks like I
> > might be able to do this as a plugin or as an interceptor and not sure
> what
> > to override on either of these interfaces?
> >
> > Any help/pointers appreciated.
> >
> > Thanks,
> >
> > Dave
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: ActiveMQ v5 plugin migration to Artemis

jbertram
What protocol are your clients going to be using?


Justin

On Fri, Feb 14, 2020 at 3:28 PM David Martin <[hidden email]> wrote:

> Thanks Chris -
>
> Unfortunately what I need to override (queue name and filter) is read only:
>
>
> https://github.com/apache/activemq-artemis/blob/master/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ConsumerInfo.java
>
> Wondering whether an interceptor is what I need? Unless I'm missing
> something blindingly obvious about these interfaces for plugins .
>
>
> Dave
>
> On Fri, Feb 14, 2020, 2:06 PM Christopher Shannon <
> [hidden email]> wrote:
>
> > Take a look at the plugin API for Artemis:
> >
> >
> https://activemq.apache.org/components/artemis/documentation/latest/broker-plugins.html
> >
> > Specifically you can implement your own ActiveMQServerPlugin (which
> extends
> > many other plugin interfaces) and has a ton of hooks into the broker to
> do
> > what you need.  ActiveMQServerConsumerPlugin probably has the methods you
> > need.
> >
> >
> >
> https://github.com/apache/activemq-artemis/blob/master/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/ActiveMQServerConsumerPlugin.java
> >
> > On Thu, Feb 13, 2020 at 9:59 AM David Martin <[hidden email]> wrote:
> >
> > > Hi everyone,
> > >
> > > Decided to switch to Artemis which is not going to be difficult in the
> > main
> > > but not sure of my best option to migrate a broker plugin which
> overrides
> > > *addConsumer()* to set a new destination and a message selector using
> > > broker-side business logic based on the user credentials. It looks
> like I
> > > might be able to do this as a plugin or as an interceptor and not sure
> > what
> > > to override on either of these interfaces?
> > >
> > > Any help/pointers appreciated.
> > >
> > > Thanks,
> > >
> > > Dave
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: ActiveMQ v5 plugin migration to Artemis

David Martin-2
Hi Justin,

AMQP or Core - can be either


Thanks,

Dave

On Fri, Feb 14, 2020, 11:02 PM Justin Bertram <[hidden email]> wrote:

> What protocol are your clients going to be using?
>
>
> Justin
>
> On Fri, Feb 14, 2020 at 3:28 PM David Martin <[hidden email]> wrote:
>
> > Thanks Chris -
> >
> > Unfortunately what I need to override (queue name and filter) is read
> only:
> >
> >
> >
> https://github.com/apache/activemq-artemis/blob/master/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ConsumerInfo.java
> >
> > Wondering whether an interceptor is what I need? Unless I'm missing
> > something blindingly obvious about these interfaces for plugins .
> >
> >
> > Dave
> >
> > On Fri, Feb 14, 2020, 2:06 PM Christopher Shannon <
> > [hidden email]> wrote:
> >
> > > Take a look at the plugin API for Artemis:
> > >
> > >
> >
> https://activemq.apache.org/components/artemis/documentation/latest/broker-plugins.html
> > >
> > > Specifically you can implement your own ActiveMQServerPlugin (which
> > extends
> > > many other plugin interfaces) and has a ton of hooks into the broker to
> > do
> > > what you need.  ActiveMQServerConsumerPlugin probably has the methods
> you
> > > need.
> > >
> > >
> > >
> >
> https://github.com/apache/activemq-artemis/blob/master/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/ActiveMQServerConsumerPlugin.java
> > >
> > > On Thu, Feb 13, 2020 at 9:59 AM David Martin <[hidden email]>
> wrote:
> > >
> > > > Hi everyone,
> > > >
> > > > Decided to switch to Artemis which is not going to be difficult in
> the
> > > main
> > > > but not sure of my best option to migrate a broker plugin which
> > overrides
> > > > *addConsumer()* to set a new destination and a message selector using
> > > > broker-side business logic based on the user credentials. It looks
> > like I
> > > > might be able to do this as a plugin or as an interceptor and not
> sure
> > > what
> > > > to override on either of these interfaces?
> > > >
> > > > Any help/pointers appreciated.
> > > >
> > > > Thanks,
> > > >
> > > > Dave
> > > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: ActiveMQ v5 plugin migration to Artemis

jbertram
Interceptors work on a per-protocol basis and the way they work for each is
slightly different. I think you can do what you want for core clients using
interceptors, but I don't think it will work for AMQP. AMQP interceptors
don't intercept low-level packets/frames like the other interceptors do
because Proton-J takes care of all the low-level work. Instead an AMQP
interceptor just intercepts incoming *messages* (i.e.
org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage instances).

I think the solution for you would be to enhance the objects you want to
change so that you actually can (e.g. make variables non-final). When all
the implementation work was done originally a plugin infrastructure wasn't
even considered. As users want/need to do more with plugins we'll need to
change the code to allow it in certain places like this.

Would you be willing to send a PR with the changes you need?


Justin

On Sat, Feb 15, 2020 at 11:14 AM David Martin <[hidden email]> wrote:

> Hi Justin,
>
> AMQP or Core - can be either
>
>
> Thanks,
>
> Dave
>
> On Fri, Feb 14, 2020, 11:02 PM Justin Bertram <[hidden email]> wrote:
>
> > What protocol are your clients going to be using?
> >
> >
> > Justin
> >
> > On Fri, Feb 14, 2020 at 3:28 PM David Martin <[hidden email]> wrote:
> >
> > > Thanks Chris -
> > >
> > > Unfortunately what I need to override (queue name and filter) is read
> > only:
> > >
> > >
> > >
> >
> https://github.com/apache/activemq-artemis/blob/master/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ConsumerInfo.java
> > >
> > > Wondering whether an interceptor is what I need? Unless I'm missing
> > > something blindingly obvious about these interfaces for plugins .
> > >
> > >
> > > Dave
> > >
> > > On Fri, Feb 14, 2020, 2:06 PM Christopher Shannon <
> > > [hidden email]> wrote:
> > >
> > > > Take a look at the plugin API for Artemis:
> > > >
> > > >
> > >
> >
> https://activemq.apache.org/components/artemis/documentation/latest/broker-plugins.html
> > > >
> > > > Specifically you can implement your own ActiveMQServerPlugin (which
> > > extends
> > > > many other plugin interfaces) and has a ton of hooks into the broker
> to
> > > do
> > > > what you need.  ActiveMQServerConsumerPlugin probably has the methods
> > you
> > > > need.
> > > >
> > > >
> > > >
> > >
> >
> https://github.com/apache/activemq-artemis/blob/master/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/ActiveMQServerConsumerPlugin.java
> > > >
> > > > On Thu, Feb 13, 2020 at 9:59 AM David Martin <[hidden email]>
> > wrote:
> > > >
> > > > > Hi everyone,
> > > > >
> > > > > Decided to switch to Artemis which is not going to be difficult in
> > the
> > > > main
> > > > > but not sure of my best option to migrate a broker plugin which
> > > overrides
> > > > > *addConsumer()* to set a new destination and a message selector
> using
> > > > > broker-side business logic based on the user credentials. It looks
> > > like I
> > > > > might be able to do this as a plugin or as an interceptor and not
> > sure
> > > > what
> > > > > to override on either of these interfaces?
> > > > >
> > > > > Any help/pointers appreciated.
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Dave
> > > > >
> > > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: ActiveMQ v5 plugin migration to Artemis

David Martin-2
Thanks Justin,

That sounds like a great idea to me - will submit a pr. It enables clients
to be quite dumb and the broker can also be in full control of what they
receive based on their credentials.


Dave

On Sat, Feb 15, 2020, 7:06 PM Justin Bertram <[hidden email]> wrote:

> Interceptors work on a per-protocol basis and the way they work for each is
> slightly different. I think you can do what you want for core clients using
> interceptors, but I don't think it will work for AMQP. AMQP interceptors
> don't intercept low-level packets/frames like the other interceptors do
> because Proton-J takes care of all the low-level work. Instead an AMQP
> interceptor just intercepts incoming *messages* (i.e.
> org.apache.activemq.artemis.protocol.amqp.broker.AMQPMessage instances).
>
> I think the solution for you would be to enhance the objects you want to
> change so that you actually can (e.g. make variables non-final). When all
> the implementation work was done originally a plugin infrastructure wasn't
> even considered. As users want/need to do more with plugins we'll need to
> change the code to allow it in certain places like this.
>
> Would you be willing to send a PR with the changes you need?
>
>
> Justin
>
> On Sat, Feb 15, 2020 at 11:14 AM David Martin <[hidden email]> wrote:
>
> > Hi Justin,
> >
> > AMQP or Core - can be either
> >
> >
> > Thanks,
> >
> > Dave
> >
> > On Fri, Feb 14, 2020, 11:02 PM Justin Bertram <[hidden email]>
> wrote:
> >
> > > What protocol are your clients going to be using?
> > >
> > >
> > > Justin
> > >
> > > On Fri, Feb 14, 2020 at 3:28 PM David Martin <[hidden email]>
> wrote:
> > >
> > > > Thanks Chris -
> > > >
> > > > Unfortunately what I need to override (queue name and filter) is read
> > > only:
> > > >
> > > >
> > > >
> > >
> >
> https://github.com/apache/activemq-artemis/blob/master/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ConsumerInfo.java
> > > >
> > > > Wondering whether an interceptor is what I need? Unless I'm missing
> > > > something blindingly obvious about these interfaces for plugins .
> > > >
> > > >
> > > > Dave
> > > >
> > > > On Fri, Feb 14, 2020, 2:06 PM Christopher Shannon <
> > > > [hidden email]> wrote:
> > > >
> > > > > Take a look at the plugin API for Artemis:
> > > > >
> > > > >
> > > >
> > >
> >
> https://activemq.apache.org/components/artemis/documentation/latest/broker-plugins.html
> > > > >
> > > > > Specifically you can implement your own ActiveMQServerPlugin (which
> > > > extends
> > > > > many other plugin interfaces) and has a ton of hooks into the
> broker
> > to
> > > > do
> > > > > what you need.  ActiveMQServerConsumerPlugin probably has the
> methods
> > > you
> > > > > need.
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> https://github.com/apache/activemq-artemis/blob/master/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/plugin/ActiveMQServerConsumerPlugin.java
> > > > >
> > > > > On Thu, Feb 13, 2020 at 9:59 AM David Martin <[hidden email]>
> > > wrote:
> > > > >
> > > > > > Hi everyone,
> > > > > >
> > > > > > Decided to switch to Artemis which is not going to be difficult
> in
> > > the
> > > > > main
> > > > > > but not sure of my best option to migrate a broker plugin which
> > > > overrides
> > > > > > *addConsumer()* to set a new destination and a message selector
> > using
> > > > > > broker-side business logic based on the user credentials. It
> looks
> > > > like I
> > > > > > might be able to do this as a plugin or as an interceptor and not
> > > sure
> > > > > what
> > > > > > to override on either of these interfaces?
> > > > > >
> > > > > > Any help/pointers appreciated.
> > > > > >
> > > > > > Thanks,
> > > > > >
> > > > > > Dave
> > > > > >
> > > > >
> > > >
> > >
> >
>