Forum Discussion

sonya_m's avatar
sonya_m
Icon for Alumni rankAlumni
5 years ago
Solved

[TechCorner Challenge #10] Connecting to JMS using Groovy script

Hi Community!

 

The TechCorner Challenge continues. You can put your skills to the test and learn something new about the tool, as well as bring more valuable content to the ReadyAPI Community! And, those who complete tasks, will get into the Leaderboard.

This week's task:

 

Sometimes, the JMS test step doesn’t suit you since you might have custom JMS settings, or you need to add additional logic before or after sending/receiving a JMS message. In this case, you can use Groovy scripts. So, try writing a sample script to connect to JMS that can be used as a basis for further customization.

 

Task: write a script for the Groovy Script test step which creates a connection to a JMS provider (ActiveMQ, WebSphere or another), sends a JMS message to the “Test“ queue, and shows all messages in this queue.

 

Difficulty

 

Notes: use the manual connection, not the HermesJMS session.

 

Check out the TechCorner Leaderboard and detailed participation rules here.

Good luck, as always!

 

9 Replies

    • sonya_m's avatar
      sonya_m
      Icon for Alumni rankAlumni

      Hi nmrao !

      Yes, we do have a requirement that makes this task a bit different from what's specified in the article🙂

       

      >>

      Notes: use the manual connection, not the HermesJMS session.

      <<

      • groovyguy's avatar
        groovyguy
        Community Hero

        So I've done something similar which relies on downloading and placing the ActiveMQ jar in the ReadyAPI library. This seems like a much easier way. I can see how to manually set up the ActiveMQ connection in the JMS connections, but I cannot figure out how to utilize that from a groovy script. At least, I haven't figured it out yet.

         

        I may have misread this, and it seems like whatever solution is there will require the JAR of the provider being used. In my instance, this will require the ActiveMQ jar. Is that a safe assumption to make, or is there a way to do this without that?