You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by Datacom - Marcelo <ma...@datacom-telematica.com.br> on 2006/05/17 20:24:16 UTC

Byte selector does not work

Hi, we're using active-mq 4.0-rc2 and realize that any message sent are 
not received if we use a selector with a byte param. Here is the two 
programs used to show this behavior. If we change this param from byte 
to int it works. Is this a known bug ?

Some parts are not shown to make this sample smaller.

(MESSAGE SENDER)

......................
    public static void main(String[] args) throws Exception {
        TopicPublisher publisher = 
getSession().createPublisher(MessageClient.topic);

        System.out.println("Started...");
        Message msg = getSession().createMessage();
        msg.setByteProperty("dummy", (byte) 33);
        publisher.publish(msg);
        System.out.println("Message sent.");
        try {Thread.sleep(10000);} catch (Exception exc) {}
        publisher.close();
        session.close();
        conn.close();
        System.out.println("Finished.");
    }
(end)


(MESSAGE RECEIVER)

......................

   public static void main(String[] args) throws Exception {
        JmsReceiverTest listen = new JmsReceiverTest();

        System.out.println("Started...");
        TopicSubscriber subscriber = 
getSession().createSubscriber(MessageClient.topic, "dummy = 33", false);
        subscriber.setMessageListener(listen);
        synchronized (listen) {
            listen.wait(30000);
        }
        subscriber.close();
        session.close();
        conn.close();
        System.out.println("Finished.");
    }

    public void onMessage(Message msg) {
        System.out.println("Message received.");
        try {
            for (Enumeration e = msg.getPropertyNames(); 
e.hasMoreElements();) {
                String name = (String) e.nextElement();
                System.out.println("Property name: " + name + ", value = 
" + msg.getObjectProperty(name));
            }
        } catch (Exception exc) {
            exc.printStackTrace();
        }
        this.notify();
    }
(end)

-- 
MARCELO Ribeiro


DATACOM
Av. França, 735 - Porto Alegre, RS - 90230-220
DDR: 51 3358 0141
Fax: 51 3358 0101
site:   www.datacom-telematica.com.br
e-mail: marcelo@datacom-telematica.com.br