activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Bain <tb...@alumni.duke.edu>
Subject RE: ActiveMQ custom plugin
Date Sun, 26 Nov 2017 03:30:45 GMT
On Nov 24, 2017 5:44 PM, "Gupta Bharat" <bharat.gupta@scania.com> wrote:

hello Tim,



My Custom Plugin is getting installed as I am using log4j to print random
stuff and its getting printed in logs.

Can you please describe in more detail exactly what methods that logging is
done in and how it proves that the plugin was actually installed? If (for
example) your logging is only in your constructor or your initialization
method, that just proves that Spring made your bean, not that it was
installed in the broker as a plugin.

I am hereby attaching my codes that you can see.

Where? All I see is your activemq.xml snippet below, but no actual code for
your plugin.

activemq.xml configurations:

<plugins>

                               <bean id="sample"

                                class="jwt.validation.Sample"

                                xmlns="http://www.
springframework.org/schema/beans"/>

                               </plugins>



Also I would like to explain you my exact requirement.



The diagram below shows what I am trying to do it now.





That sounds like it should be doable via an interceptor based on what I
know about them (i.e. the wiki, but no hands-on experience).

QUESTIONS:



1.       how can we provide JWT to custom plugin from client?

If you have to use MQTT, you'll need to encode it directly into the message
body, because that's all MQTT supports. You could for example make a JSON
payload with two fields: the JWT and the message body. Or you could switch
to OpenWire and put the JWT into a custom header on the message the client
is sending.

2.       do we need to store jwt in topic first and then consume it from
topic to validate it? (not idle case)

You need to put the JWT into the message itself so that your plugin can
evaluate the token and then decide what to do with the message based on
that evaluation.

3.       can we call restful service from activeMQ broker that can validate
token and gives the result back to broker?

Yes, as far as I know, you'd be able to do that from within the broker.
(I've never done that, but I'm not aware of anything that would prevent you
from doing it.)

Tim please let me know if I am clear with my requirements. Else we can talk
more on call/phone.



Thanks in advance





Regards,

Bharat Gupta

Development & Support | Platform Technician, IXCB | Scania IT

Mobile: +46700869007 <+46%2070%20086%2090%2007>, +91-9718483802
<+91%2097184%2083802>

bharat.gupta@scania.com





-----Original Message-----
From: tbain98@gmail.com [mailto:tbain98@gmail.com] On Behalf Of Tim Bain
Sent: Friday, November 24, 2017 7:19 PM
To: ActiveMQ Users <users@activemq.apache.org>
Cc: users-owner@activemq.apache.org
Subject: RE: ActiveMQ custom plugin



1. Your send() method needs to call super.send() after doing your custom

work, otherwise the message will never be sent to the real Broker object.

Please review the wiki page I referred to earlier, which covers how to

implement an interceptor.



2. To me it sounds like your plugin isn't getting installed. Do you have

any indication that it is, from logs or some other mechanism? And can you

please share the code of the class that implements BrokerPlugin, to confirm

that your installPlugin() method looks right, and the XML block where you

create the plugin bean?



Tim



On Nov 24, 2017 8:39 AM, "Gupta Bharat" <bharat.gupta@scania.com> wrote:



> Hello,

>

> I tried implementing the method as below:

>

>         public void send(ProducerBrokerExchange producerExchange,

> ActiveMQMessage messageSend) throws JMSException

>          {

>                   byte[] messageBytes = messageSend.getContent().data;

>                   String message = new String(messageBytes);

>                   logger.info("messageBody" + message);

>         }

>

> Also I am publishing a message on a topic even though this send() method

> is not been called as logger.info is not getting printed in my Custom

> Plugin.

>

> Could you please help me on this?

>

> Regards,

> Bharat Gupta

> Development & Support | Platform Technician, IXCB | Scania IT

> Mobile: +46700869007 <+46%2070%20086%2090%2007>, +91-9718483802
<+91%2097184%2083802>

> bharat.gupta@scania.com

>

>

> -----Original Message-----

> From: tbain98@gmail.com [mailto:tbain98@gmail.com <tbain98@gmail.com>] On
Behalf Of Tim Bain

> Sent: Friday, November 24, 2017 7:15 PM

> To: ActiveMQ Users <users@activemq.apache.org>

> Cc: users-owner@activemq.apache.org

> Subject: Re: ActiveMQ custom plugin

>

> As I said in your other thread, you would do that by implementing code in

> the send() method of your subclass of BrokerFilter, which you would create

> and return in your installPlugin() method.

>

> Tim

>

> On Nov 24, 2017 3:51 AM, "Gupta Bharat" <bharat.gupta@scania.com> wrote:

>

> Hello,

>

> I have a scenario as follows:

>

>

> 1.       I have Custom Plugins that decrypts the data and validates it.

>

> 2.       I am getting Encrypted data (token) from user that need to be

> decrypted on custom plugin.

>

> 3.       Client is accessing the broker using mqtt protocol

>

> Need Solution for the following:

>

> 1.       Before getting data onto topic on ACtiveMQ broker I need to

> validate the  data(token) in my custom plugin

>

> 2.       How to extract a data what customer is sending? So that I can

> extract the data, decrypt the message and validate.

>

>

> Implementation so far:

>

> 1.       Custom Plugin is ready and JAR has been added in <ActiveMQ>/libs

>

> 2.       Added the plugin configuration in activemq.xml

>

>

> Could anyone help me with a solution for the same as it's critical case.

>

> Thank you In Advance

>

> Regards,

> Bharat Gupta

> Development & Support | Platform Technician, IXCB | Scania IT

> Mobile: +46700869007 <+46%2070%20086%2090%2007>, +91-9718483802
<+91%2097184%2083802>

> bharat.gupta@scania.com<mailto:bharat.gupta@scania.com>

>

Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message