4 Replies Latest reply on Apr 12, 2010 2:24 AM by jganoff

    JMS Seam 3 Module event with qualifiers example

    awestwel

      Hey Jordan / Dan


      Could you guys provide a quick sample or explain based on the URL My Link with qualifiers support? In your example you demonstrate firing a event for a object (String) but it does not show how you are passing the qualifiers for the event across


      For example, lets say I have use the code snippet below which fires a event with say two qualifier annotations, how would I pull the annotations out of the ObjectMessage to re-fire the event on the consumer side to the remote application? As detailed below


      public class EventProducer {
      
          private @Inject BeanManager beanManager;
      
          private void fire() {
              beanManager.fireEvent("Test", Anotation... annotations); 
          }
      }





      @Test(timeout=5000)
      public void forwardEvent() throws Exception
      {
         String expected = "test";
         jmsExt.register(String.class, t);
         MessageConsumer mc = s.createConsumer(t);
         c.start();
         event.fire(expected);
         Message m = mc.receive();
         assertNotNull(m);
         assertTrue(m instanceof ObjectMessage);
         assertEquals(expected, ((ObjectMessage) m).getObject());
      
         // How do I get the qualifiers that existed when this event was fired?
         beanManager.fireEvent(((ObjectMessage) m).getObject(), Anotation... annotations); 
      }