4 Replies Latest reply on Feb 27, 2012 6:01 PM by jbertram

    Read and query HornetQ journal with Java ?

    akrambenaissi

      Hi Hornets !

       

       

      Can anyone telle me if there is an easy way to read HornetQ Journal from an application (I mean and EJB or a Servlet like method) running on JBoss AS ?

      How can I get the instance of the Journal ? is it accessible and registred in JNDI ?

       

      Moreover, I would like to query it: For example, assuming that I store a field timestamp in my messages, I want all messages with a timestamp higher than a given one. Is it feasible? performant?

       

      I would like to avoid storing my messages in a relationnal database just to have the query feature.

       

      Greetings

      Akram

        • 1. Re: Read and query HornetQ journal with Java ?
          jbertram

          I don't think "querying" the journal directly is feasible.  Why not use a message selector?  The JMS message selector's syntax is based on a subset of the SQL92 conditional expression syntax. 

          1 of 1 people found this helpful
          • 2. Re: Read and query HornetQ journal with Java ?
            akrambenaissi

            Hi Justin,

             

            A selector will not help, because I want to get messages with timestamp later than a given one. And this given one will vary between queries and clients.

             

            Moreover, my clients will not use JMS directly. They will connect to a webapp that will return only the selected messages given the filter.

             

            So what I will finally do is create a MDB that will consume messages later and put them in database.

             

            Greetings

            Akram

            • 3. Re: Read and query HornetQ journal with Java ?
              clebert.suconic

              We have the PrintData tool, and Justin is working on an export Tool to export messages on a XML format.

               

               

              You can create a Consumer with the filter you want maybe? You can't query the journal like a database after a message system is not a database.

               

              (that approach usually fails really badly with any message system you choose)

              • 4. Re: Read and query HornetQ journal with Java ?
                jbertram

                I'm still not sure why a selector wouldn't work.  You can query on JMSTimestamp.

                 

                Also, your clients don't necessarily need to use JMS directly.  If they are connecting to a webapp then the webapp can use a JMS selector and then return the results to the client in whatever format is appropriate.