0

I need to delete durable subscribers after each JMeter's test run using JMeter.

I would like to create HTTP request to the ActiveMQ Web Console as it is shown on browser WebConsole.

enter image description here

But I need to know:

  1. What is the "secret" parameter in URL?
  2. How it can be generated?
  3. If it will be valid for JMeter's HTTP request?
  • Given that it's called "secret", I'm guessing you're not supposed to know. Most likely, it is there specifically to stop you accessing the link without first logging in and loading the screen you show. – IMSoP Mar 10 '21 at 17:10

2 Answers2

2

The "secret" parameter was introduced to stop Cross Site Request Forgery (CSRF) attacks on the web console. See AMQ-2613 for more details on that.

You will not be able to generate your own "secret" in order to send a valid request to that URL from JMeter.

You should instead use ActiveMQ's integration with the Jolokia JMX-HTTP bridge to interact directly with ActiveMQ's JMX management beans. For example, the DurableSubscriptionViewMBean has a destroy method you can invoke.

That said, the best option would be to simply invoke javax.jms.Session#unsubscribe() from your JMS client. This is the normal way subscriptions are supposed to be deleted.

Justin Bertram
  • 29,372
  • 4
  • 21
  • 43
0

You don't need to "generate" this value, you need to "extract" this value from the previous response using a suitable Post-Processor (CSS Selector Extractor is a good choice)

Just inspect the immediately previous response source and you will see this "secret" value there. Fetch it, store into a JMeter Variable and you should be good to go.

More information: How to Load Test CSRF-Protected Web Sites

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • I use CSS Selector Extractor, write value into Variable but when I use it in next request I always get 500 Server Error. How can I handle it? [screenshots](https://photos.app.goo.gl/Hc5cpckJfJhj5MNfA) – Juliia Polishchuk Mar 11 '21 at 17:52
  • @JuliiaPolishchuk, are you actually trying to test the ActiveMQ web console or are you just trying to delete the durable subscription and using the URL from the web console seems like the easiest way? – Justin Bertram Mar 11 '21 at 19:28
  • @JustinBertram I am trying to delete durable subscriptions for test debagging. After my test finished I have 500 durable subscriptions and it's very painful delete it manually through ActiveMQ Web Console. – Juliia Polishchuk Mar 11 '21 at 20:05
  • If you're not actually testing the web console why are you trying to use the web console for this operation when you have other alternatives to delete the durable subscription? – Justin Bertram Mar 11 '21 at 20:10
  • @JustinBertram unfortunately I didn't know other alternatives how to do it with JMeter. But I will try your advise. Thank you! – Juliia Polishchuk Mar 12 '21 at 09:03