2 Replies Latest reply on Jul 30, 2012 4:43 AM by jmesnil

    HornetQ Interceptors + Jboss AS 7

    psvn

      Hi all,

       

      I've been trying to use HornetQ interceptors in Jboss 7.0.2, but nothing happens! I don't know if I am missing something.

       

      I have the interceptor and my MDB deployed on my jboss7 and I am sending messages to the queue by:

      Queue queue = HornetQJMSClient.createQueue("mdbQueue");
      TransportConfiguration transportConfiguration = new TransportConfiguration(NettyConnectorFactory.class.getName());
      HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.CF, transportConfiguration);
      

      outside JBoss.

       

       

      I've created the interceptor like that:

      public class FirstInterceptor implements Interceptor {
            public boolean intercept(final Packet packet, final RemotingConnection connection) throws HornetQException {
              System.out.println("FirstInterceptor gets called!");
               (....)
              return true;
           }
      }
      

       

      My configuration in standalone-preview.xml:

      (...)
              <subsystem xmlns="urn:jboss:domain:messaging:1.0">
                  <remoting-interceptors>
                      <class-name>
                          org.hornetq.example.interceptors.FirstInterceptor
                      </class-name>
                  </remoting-interceptors>
                  <journal-type>
      (...)
      

       

      Do i need to set something on my queue to used the interceptor?

                  <jms-destinations>
                      <jms-queue name="mdbQueue">
                          <entry name="queue/mdbQueue"/>
                      </jms-queue>
                  </jms-destinations>
      
      

       

      Other question, is it possible to apply specific interceptors for each queue? For example If i have 2 queues and I want to use one interceptor in one queue and others in the other queue?

       

      Can someone help me?

       

      Thanks in advance!!