[jboss-user] [JBoss Messaging] - Re: Messages Stuck in Queue

clebert.suconic@jboss.com do-not-reply at jboss.com
Tue Oct 3 16:16:55 EDT 2006


Messageconsumer is associated with your Session, so.. the behavior you were getting is correct. (I mean.. it was correct that you got an error :-) )


anyway... By the time I was coming to write a post I saw your message.

I was going to post the testcase that I got, and didn't get any failure. Just for reference now (as you got your problem solved), I will paste the testcase here:

Cheers,

Clebert


  |     public void testSelectiveOnServerId() throws Exception
  |     {
  |        Connection conn = cf.createConnection();
  |        conn.start();
  | 
  |        Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
  |        MessageProducer prod = session.createProducer(queue);
  |        prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
  | 
  |        int serverId=((ConnectionState)(((ClientConnectionDelegate)((JBossConnection)conn).getDelegate()).getState())).getServerID();
  | 
  |        String selector = "serverID = " + serverId;
  |        MessageConsumer serverConsumer = session.createConsumer(queue, selector);
  |        conn.start();
  | 
  |        Message redMessage = session.createMessage();
  |        redMessage.setStringProperty("color", "red");
  | 
  |        Message blueMessage = session.createMessage();
  |        blueMessage.setStringProperty("color", "blue");
  |        blueMessage.setIntProperty("serverID",serverId);
  | 
  |        prod.send(redMessage);
  |        prod.send(blueMessage);
  | 
  |        Message rec = serverConsumer.receive(3000);
  |        assertNotNull(rec);
  |        assertNull(serverConsumer.receive(1000));
  |        assertEquals(blueMessage.getJMSMessageID(), rec.getJMSMessageID());
  |        assertEquals("blue", rec.getStringProperty("color"));
  | 
  | 
  |        serverConsumer.close();
  | 
  |        session.close();
  |     }
  | 
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3975867#3975867

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3975867



More information about the jboss-user mailing list